Re: invalidate session after calling listeners

2005-08-29 Thread Franklin Phan

Hassan,

How do I add an instance of the listener to each session?  Can you please 
provide an example?

I forgot to mention that I already have the following in the first JSP after 
the login is validated:

jsp:useBean id=listener class=abcd.AbcdSessionListener scope=session /

%
session.setAttribute(sessionListener, listener);
%


What you say, ...and that object receives the event, it still knows its attributes.  
What do you mean by object?  Which object?

Thanks.


Hassan Schroeder wrote:

Franklin Phan wrote:

I'm trying to code a method to clean up specifically named files 
inside a working dir (in Windows XP) whenever the session times out.  



Rather than a global listener approach, why not just add an instance
of your listener *to each session*? When the session ends and that
object receives the event, it still knows its attributes; from your
example:

 public void valueUnbound(HttpSessionBindingEvent se) {
AbcdUtil util = new AbcdUtil();

/* -- neither of these is necessary, as userId is still defined
 *   HttpSession session = se.getSession();
 *   String userId = (String)session.getValue(userId);
 */

I use this approach to return items to stock from an abandoned (via
session timeout) shopping cart, for instance.

FWIW!



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-29 Thread Franklin Phan

Hassan,

Also, I don't understand the difference between a global and a non-global 
listener approach.  Can you explain?  Thanks.

Thanks.


Hassan Schroeder wrote:

Franklin Phan wrote:

I'm trying to code a method to clean up specifically named files 
inside a working dir (in Windows XP) whenever the session times out.  



Rather than a global listener approach, why not just add an instance
of your listener *to each session*? When the session ends and that
object receives the event, it still knows its attributes; from your
example:

 public void valueUnbound(HttpSessionBindingEvent se) {
AbcdUtil util = new AbcdUtil();

/* -- neither of these is necessary, as userId is still defined
 *   HttpSession session = se.getSession();
 *   String userId = (String)session.getValue(userId);
 */

I use this approach to return items to stock from an abandoned (via
session timeout) shopping cart, for instance.

FWIW!



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-29 Thread Franklin Phan

Hassan,

I have found the solution.  I think that a big part of what you were saying was something that I was already doing but neglected to mention (i.e., having a line of code in the JSP to bind the 
listener object to the session using setAttribute).


Your commenting out my two lines of code did hint to me to take a closer look 
at the Servlet API Documentation.
The API documentation for HttpSession interface says:

When an application stores an object in or removes an object from a session, the session checks whether the object implements HttpSessionBindingListener. If it does, the servlet notifies the 
object that it has been bound to or unbound from the session.


Reading that again did clarify for me what it means for an object to implement 
HttpSessionBindingListener and led me to add the following:

session.getServletContext().getRealPath(XML_WORK_PATH)

to the valueBound method to set an instance variable because that's where the 
session object is still valid.  I then removed the two lines of code from 
valueUnbound as you indicated.

Thanks.

What threw me off in the first place was the poor API documentation for 
HttpSessionBindingListener interface.  It says for valueUnbound:
Notifies the object that it is being unbound from a session and identifies the 
session.

It gave me the impression that the method itself notifies the object (which is the object that contains the implementation of HttpSessionBindingListener itself) and provides a reference to the 
session.


The API documentation for that method should have said something like:

This method is called *upon receiving notification* that this object is being 
unbound from the *invalidated* session.

Thanks, again.

Still, though, what is a global listener approach?



Franklin Phan wrote:

Hassan,

How do I add an instance of the listener to each session?  Can you 
please provide an example?


I forgot to mention that I already have the following in the first JSP 
after the login is validated:


jsp:useBean id=listener class=abcd.AbcdSessionListener 
scope=session /


%
session.setAttribute(sessionListener, listener);
%


What you say, ...and that object receives the event, it still knows its 
attributes.  What do you mean by object?  Which object?


Thanks.


Hassan Schroeder wrote:


Franklin Phan wrote:

I'm trying to code a method to clean up specifically named files 
inside a working dir (in Windows XP) whenever the session times out.  




Rather than a global listener approach, why not just add an instance
of your listener *to each session*? When the session ends and that
object receives the event, it still knows its attributes; from your
example:

 public void valueUnbound(HttpSessionBindingEvent se) {
AbcdUtil util = new AbcdUtil();

/* -- neither of these is necessary, as userId is still defined
 *   HttpSession session = se.getSession();
 *   String userId = (String)session.getValue(userId);
 */

I use this approach to return items to stock from an abandoned (via
session timeout) shopping cart, for instance.

FWIW!




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-29 Thread Hassan Schroeder

Franklin Phan wrote:

I have found the solution. 


Cool. :-)

What threw me off in the first place was the poor API documentation for 
HttpSessionBindingListener interface.  It says for valueUnbound:
Notifies the object that it is being unbound from a session and 
identifies the session.


It gave me the impression that the method itself notifies the object 
(which is the object that contains the implementation of 
HttpSessionBindingListener itself) and provides a reference to the session.


The API documentation for that method should have said something like:

This method is called *upon receiving notification* that this object is 
being unbound from the *invalidated* session.


Erm, yeah, the docs are sometimes a bit opaque.


Still, though, what is a global listener approach?


I was just making a distinction between having a single Context-wide
process (listener) doing session-unbound tasks versus each /session/
having a bound object implementing HttpSessionBindingListener doing
its own.

It's the difference between Mom cleaning up after everyone, or all
the kids cleaning their own rooms :-)

HTH!
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

  dream.  code.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-27 Thread Hassan Schroeder

Franklin Phan wrote:

I'm trying to code a method to clean up specifically named files inside 
a working dir (in Windows XP) whenever the session times out.  


Rather than a global listener approach, why not just add an instance
of your listener *to each session*? When the session ends and that
object receives the event, it still knows its attributes; from your
example:

 public void valueUnbound(HttpSessionBindingEvent se) {
AbcdUtil util = new AbcdUtil();

/* -- neither of these is necessary, as userId is still defined
 *   HttpSession session = se.getSession();
 *   String userId = (String)session.getValue(userId);
 */

I use this approach to return items to stock from an abandoned (via
session timeout) shopping cart, for instance.

FWIW!
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

  dream.  code.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



invalidate session after calling listeners

2005-08-26 Thread Franklin Phan

Is there a way to set Tomcat to call listeners before invalidate() is called on 
a session?
I'm trying to code a method to clean up specifically named files inside a working dir (in Windows XP) whenever the session times out.  I can't seem to find a way to do it.  Apparently, 
invalidate() is called prior to calling listeners, and these specifically named files that I want to clean up are named after the user ID that is stored in the HttpSession object (meaning 
I'd need to access the session object.  I understand Resin has a setting called invalidate-after-listener and am wondering whether Tomcat has same.


Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-26 Thread Darek Czarkowski
You could implement HttpSessionBindingListener and define your own
valueBound and valueUnbound methods.

DarekC

On Fri, 2005-08-26 at 13:08, Franklin Phan wrote:
 Is there a way to set Tomcat to call listeners before invalidate() is called 
 on a session?
 I'm trying to code a method to clean up specifically named files inside a 
 working dir (in Windows XP) whenever the session times out.  I can't seem to 
 find a way to do it.  Apparently, 
 invalidate() is called prior to calling listeners, and these specifically 
 named files that I want to clean up are named after the user ID that is 
 stored in the HttpSession object (meaning 
 I'd need to access the session object.  I understand Resin has a setting 
 called invalidate-after-listener and am wondering whether Tomcat has same.
 
 Thanks.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: invalidate session after calling listeners

2005-08-26 Thread Franklin Phan

Darek,

I've tried your suggestion.  As I've said before: I need to access the Session 
object.  This is what I have:

package abcd;

import java.io.*;
import javax.servlet.http.*;

public class AbcdSessionListener implements HttpSessionBindingListener {

  private String userId;
  public void valueBound(HttpSessionBindingEvent se) {
HttpSession session = se.getSession();
userId = (String)session.getValue(userId);
  }

  public void valueUnbound(HttpSessionBindingEvent se) {
AbcdUtil util = new AbcdUtil();
HttpSession session = se.getSession(); // ---This is not possible because 
the session is already invalidated at this point.
String userId = (String)session.getValue(userId);

// Clean up the folder of old XML files by the same user from previous 
login (uses the AbcdUtil class)
String XML_WORK_PATH = /WEB-INF/work_xml;
File[] files = 
util.fileSearch(session.getServletContext().getRealPath(XML_WORK_PATH), userId + 
_*.*);

for (int i = 0; i  files.length; i++) {
files[i].delete();
}
  }
} // End AbcdSessionListener


And I use the following in a JSP:

jsp:useBean id=listener class=abcd.AbcdSessionListener scope=session /

%
session.setAttribute(sessionListener, listener);
%

All this fails with or without a listener element in the web.xml entry (and 
how should one decide whether or not to put one in web.xml?).
If you read the Servlet API Documentation for the HttpSession Interface 
(http://jakarta.apache.org/tomcat/tomcat-5.5-doc/servletapi/index.html), it 
says:
For session that are invalidated or expire, notifications are sent after the 
session has been invalidated or expired.  Pretty useless, if you ask me.

Any advice?


Franklin



Darek Czarkowski wrote:

You could implement HttpSessionBindingListener and define your own
valueBound and valueUnbound methods.

DarekC

On Fri, 2005-08-26 at 13:08, Franklin Phan wrote:


Is there a way to set Tomcat to call listeners before invalidate() is called on 
a session?
I'm trying to code a method to clean up specifically named files inside a working dir (in Windows XP) whenever the session times out.  I can't seem to find a way to do it.  Apparently, 
invalidate() is called prior to calling listeners, and these specifically named files that I want to clean up are named after the user ID that is stored in the HttpSession object (meaning 
I'd need to access the session object.  I understand Resin has a setting called invalidate-after-listener and am wondering whether Tomcat has same.


Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SV: Cluster: will session listeners got called again after replication?

2005-03-02 Thread Filip Hanik - Dev lists
listeners will not be invoked on a state transfer, as it is not 
considered an event.
when a new member joins the cluster, it requests a state transfer from 
one of the other members.

Joseph Lam wrote:
I have it turned on already. But seems that after a node is killed and
then started up again, even though it can pick up the sessions from the
other nodes, my HttpSessionBindingListener and HttpSessionListener were
not called at all during the replication.
Joseph
On Fri, 25 Feb 2005, Filip Hanik - Dev Lists wrote:
 

there is a flag you can set so that listeners don't get called, its optional
its called notifyListenersOnReplication, see server.xml for example, 
default is true

Filip
Jesper Ekberg wrote:
   

Hello!
My first mail to this list. :)
I have read it for a long time tho.
We have a tried to cluster 3 Tomcat 5.5.7 machines and I found that 
HttpSessionBindingListener will be notified when the session is replicated and 
the machine crashes.
I think this must be a bug??
The scenario:
3 Tomcat 5.5.7 machines on Windows 2003 Server (I know, not my fault ;)).
JK2 Connector for load balancing.
I log on and session is created and is replicated correctly to all machines.
I shut down the server that I'm working on.
The session is destroyed and method valueUnbound is called on the crashed 
machine.
It seems odd to me that the method valueUnbound is called when the session is replicated, 
the session still lives on the other Tomcat machines.
Sorry for my sometimes bad English ;)
//Jesper
-Ursprungligt meddelande-
Från: Joseph Lam [mailto:[EMAIL PROTECTED] 
Skickat: den 24 februari 2005 08:44
Till: Tomcat Users List
Ämne: Cluster: will session listeners got called again after replication?

Anyone knows when a session is replicated to other nodes, will the
HttpSessionBindingListener and HttpSessionAttributeListener objects be
notified again? On the receiver nodes, how can I detect when a session
 

from the sender node comes in so that I can do something with it?
   

Joseph
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

   


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SV: Cluster: will session listeners got called again after replication?

2005-02-27 Thread Joseph Lam
I have it turned on already. But seems that after a node is killed and
then started up again, even though it can pick up the sessions from the
other nodes, my HttpSessionBindingListener and HttpSessionListener were
not called at all during the replication.


Joseph


On Fri, 25 Feb 2005, Filip Hanik - Dev Lists wrote:

 there is a flag you can set so that listeners don't get called, its optional
 
 its called notifyListenersOnReplication, see server.xml for example, 
 default is true
 
 Filip
 
 Jesper Ekberg wrote:
 
 Hello!
 My first mail to this list. :)
 I have read it for a long time tho.
 We have a tried to cluster 3 Tomcat 5.5.7 machines and I found that 
 HttpSessionBindingListener will be notified when the session is replicated 
 and the machine crashes.
 I think this must be a bug??
 
 The scenario:
 3 Tomcat 5.5.7 machines on Windows 2003 Server (I know, not my fault ;)).
 JK2 Connector for load balancing.
 I log on and session is created and is replicated correctly to all machines.
 I shut down the server that I'm working on.
 The session is destroyed and method valueUnbound is called on the crashed 
 machine.
 It seems odd to me that the method valueUnbound is called when the session 
 is replicated, the session still lives on the other Tomcat machines.
 
 Sorry for my sometimes bad English ;)
 
 //Jesper
 
 -Ursprungligt meddelande-
 Från: Joseph Lam [mailto:[EMAIL PROTECTED] 
 Skickat: den 24 februari 2005 08:44
 Till: Tomcat Users List
 Ämne: Cluster: will session listeners got called again after replication?
 
 Anyone knows when a session is replicated to other nodes, will the
 HttpSessionBindingListener and HttpSessionAttributeListener objects be
 notified again? On the receiver nodes, how can I detect when a session
 from the sender node comes in so that I can do something with it?
 
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
   
 
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SV: Cluster: will session listeners got called again after replication?

2005-02-25 Thread Filip Hanik - Dev Lists
there is a flag you can set so that listeners don't get called, its optional
its called notifyListenersOnReplication, see server.xml for example, 
default is true

Filip
Jesper Ekberg wrote:
Hello!
My first mail to this list. :)
I have read it for a long time tho.
We have a tried to cluster 3 Tomcat 5.5.7 machines and I found that 
HttpSessionBindingListener will be notified when the session is replicated and 
the machine crashes.
I think this must be a bug??
The scenario:
3 Tomcat 5.5.7 machines on Windows 2003 Server (I know, not my fault ;)).
JK2 Connector for load balancing.
I log on and session is created and is replicated correctly to all machines.
I shut down the server that I'm working on.
The session is destroyed and method valueUnbound is called on the crashed 
machine.
It seems odd to me that the method valueUnbound is called when the session is replicated, 
the session still lives on the other Tomcat machines.
Sorry for my sometimes bad English ;)
//Jesper
-Ursprungligt meddelande-
Från: Joseph Lam [mailto:[EMAIL PROTECTED] 
Skickat: den 24 februari 2005 08:44
Till: Tomcat Users List
Ämne: Cluster: will session listeners got called again after replication?

Anyone knows when a session is replicated to other nodes, will the
HttpSessionBindingListener and HttpSessionAttributeListener objects be
notified again? On the receiver nodes, how can I detect when a session
from the sender node comes in so that I can do something with it?
Joseph
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SV: Cluster: will session listeners got called again after replication?

2005-02-25 Thread Filip Hanik - Dev Lists
there is a difference between a crashed tomcat and a shutdown tomcat.

Filip
Filip Hanik - Dev Lists wrote:
there is a flag you can set so that listeners don't get called, its 
optional

its called notifyListenersOnReplication, see server.xml for example, 
default is true

Filip
Jesper Ekberg wrote:
Hello!
My first mail to this list. :)
I have read it for a long time tho.
We have a tried to cluster 3 Tomcat 5.5.7 machines and I found that 
HttpSessionBindingListener will be notified when the session is 
replicated and the machine crashes.
I think this must be a bug??

The scenario:
3 Tomcat 5.5.7 machines on Windows 2003 Server (I know, not my fault 
;)).
JK2 Connector for load balancing.
I log on and session is created and is replicated correctly to all 
machines.
I shut down the server that I'm working on.
The session is destroyed and method valueUnbound is called on the 
crashed machine.
It seems odd to me that the method valueUnbound is called when the 
session is replicated, the session still lives on the other Tomcat 
machines.

Sorry for my sometimes bad English ;)
//Jesper
-Ursprungligt meddelande-
Från: Joseph Lam [mailto:[EMAIL PROTECTED] Skickat: den 24 februari 2005 
08:44
Till: Tomcat Users List
Ämne: Cluster: will session listeners got called again after 
replication?

Anyone knows when a session is replicated to other nodes, will the
HttpSessionBindingListener and HttpSessionAttributeListener objects be
notified again? On the receiver nodes, how can I detect when a session
from the sender node comes in so that I can do something with it?
Joseph
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


SV: Cluster: will session listeners got called again after replication?

2005-02-24 Thread Jesper Ekberg
Hello!
My first mail to this list. :)
I have read it for a long time tho.
We have a tried to cluster 3 Tomcat 5.5.7 machines and I found that 
HttpSessionBindingListener will be notified when the session is replicated and 
the machine crashes.
I think this must be a bug??

The scenario:
3 Tomcat 5.5.7 machines on Windows 2003 Server (I know, not my fault ;)).
JK2 Connector for load balancing.
I log on and session is created and is replicated correctly to all machines.
I shut down the server that I'm working on.
The session is destroyed and method valueUnbound is called on the crashed 
machine.
It seems odd to me that the method valueUnbound is called when the session is 
replicated, the session still lives on the other Tomcat machines.

Sorry for my sometimes bad English ;)

//Jesper

-Ursprungligt meddelande-
Från: Joseph Lam [mailto:[EMAIL PROTECTED] 
Skickat: den 24 februari 2005 08:44
Till: Tomcat Users List
Ämne: Cluster: will session listeners got called again after replication?

Anyone knows when a session is replicated to other nodes, will the
HttpSessionBindingListener and HttpSessionAttributeListener objects be
notified again? On the receiver nodes, how can I detect when a session
from the sender node comes in so that I can do something with it?

Joseph


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Cluster: will session listeners got called again after replication?

2005-02-23 Thread Joseph Lam
Anyone knows when a session is replicated to other nodes, will the
HttpSessionBindingListener and HttpSessionAttributeListener objects be
notified again? On the receiver nodes, how can I detect when a session
from the sender node comes in so that I can do something with it?

Joseph


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Listeners

2004-10-13 Thread Ray Madigan
I have never used Listeners in Tomcat before and and having trouble getting
one registered.

I have the listener declared in web.xml before the servlet declaration and
looks like

  listener
listener-class com.mbresearch.foo.FooListener/listener-class
  /listener

  servlet
...

com.mbresearch.foo.FooListener is in the WEB-INF/classes directory.
I get the digester error:

Digester.error : Parse Error at line 9 column 13: Element type listener
must be declared.  Line 9 is the listener line.

What am I missing?  Thanks in advance!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Listeners

2004-10-13 Thread Ray Madigan

The top of my web.xml is as follows.  It worked fine until I added the
listener declaration.

I am using tomcat 4.1.24

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app

  listener
listener-class com.mbresearch.main.util.AccessListener
/listener-class
  /listener

  servlet

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 12:58 AM
To: Tomcat Users List
Subject: Re: Listeners


What version of Tomcat you are using ?. Also post the web.xml version.
From the top.

rgds
Antony Paul


On Wed, 13 Oct 2004 00:46:43 -0700, Ray Madigan [EMAIL PROTECTED] wrote:
 I have never used Listeners in Tomcat before and and having trouble
getting
 one registered.

 I have the listener declared in web.xml before the servlet declaration and
 looks like

  listener
listener-class com.mbresearch.foo.FooListener/listener-class
  /listener

  servlet
 ...

 com.mbresearch.foo.FooListener is in the WEB-INF/classes directory.
 I get the digester error:

 Digester.error : Parse Error at line 9 column 13: Element type listener
 must be declared.  Line 9 is the listener line.

 What am I missing?  Thanks in advance!

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Listeners

2004-10-13 Thread Antony Paul
I could'nt find anything wrong with the listener element. Perhaps it
is caused by something else. Remove all other elements than listener
and try to see the error. Also post the full error log.

rgds
Antony Paul


On Wed, 13 Oct 2004 01:14:15 -0700, Ray Madigan [EMAIL PROTECTED] wrote:
 
 The top of my web.xml is as follows.  It worked fine until I added the
 listener declaration.
 
 I am using tomcat 4.1.24
 
 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
 web-app
 
  listener
listener-class com.mbresearch.main.util.AccessListener
 /listener-class
  /listener
 
  servlet
 
 
 
 -Original Message-
 From: Antony Paul [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 13, 2004 12:58 AM
 To: Tomcat Users List
 Subject: Re: Listeners
 
 What version of Tomcat you are using ?. Also post the web.xml version.
 From the top.
 
 rgds
 Antony Paul
 
 On Wed, 13 Oct 2004 00:46:43 -0700, Ray Madigan [EMAIL PROTECTED] wrote:
  I have never used Listeners in Tomcat before and and having trouble
 getting
  one registered.
 
  I have the listener declared in web.xml before the servlet declaration and
  looks like
 
   listener
 listener-class com.mbresearch.foo.FooListener/listener-class
   /listener
 
   servlet
  ...
 
  com.mbresearch.foo.FooListener is in the WEB-INF/classes directory.
  I get the digester error:
 
  Digester.error : Parse Error at line 9 column 13: Element type listener
  must be declared.  Line 9 is the listener line.
 
  What am I missing?  Thanks in advance!
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Listeners

2004-10-13 Thread François Richard
Does your listener class implement the good listener like 
HttpSessionListener, ServletContextListener or ...

Ray Madigan wrote:
The top of my web.xml is as follows.  It worked fine until I added the
listener declaration.
I am using tomcat 4.1.24
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
 listener
   listener-class com.mbresearch.main.util.AccessListener
/listener-class
 /listener
 servlet
-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 12:58 AM
To: Tomcat Users List
Subject: Re: Listeners
What version of Tomcat you are using ?. Also post the web.xml version.
From the top.
rgds
Antony Paul
On Wed, 13 Oct 2004 00:46:43 -0700, Ray Madigan [EMAIL PROTECTED] wrote:
 

I have never used Listeners in Tomcat before and and having trouble
   

getting
 

one registered.
I have the listener declared in web.xml before the servlet declaration and
looks like
listener
  listener-class com.mbresearch.foo.FooListener/listener-class
/listener
servlet
...
com.mbresearch.foo.FooListener is in the WEB-INF/classes directory.
I get the digester error:
Digester.error : Parse Error at line 9 column 13: Element type listener
must be declared.  Line 9 is the listener line.
What am I missing?  Thanks in advance!
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Listeners

2004-10-13 Thread Shapira, Yoav

Hi,

I have the listener declared in web.xml before the servlet declaration
and
looks like

  listener
listener-class com.mbresearch.foo.FooListener/listener-class
  /listener

  servlet
...

com.mbresearch.foo.FooListener is in the WEB-INF/classes directory.

Your web.xml looks fine.  Your listener doesn't actually have to
implement any of the Servlet Spec's listener interfaces (but of course
then it's a fairly useless class ;)).  However, I want to make sure your
listener class can be found. The FooListener.class file should be in
WEB-INF/classes/com/mbresearch/foo directory, and have package
com.mbresearch.foo; as its top line.  It should also be readable to the
server user.

Yoav



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SEVERE: Error reading tld listeners java.lang.NullPointerException

2004-07-09 Thread Robert Hunt

Why does this happen during startup?

Jul 9, 2004 2:05:07 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-30041
Jul 9, 2004 2:05:07 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1328 ms
Jul 9, 2004 2:05:07 PM org.apache.catalina.core.StandardService start
INFO: Starting service JTProdSvc
Jul 9, 2004 2:05:07 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.25
Jul 9, 2004 2:05:08 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 9, 2004 2:05:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Error reading tld listeners java.lang.NullPointerException
java.lang.NullPointerException
 at java.util.Arrays.sort(Unknown Source)
 at org.apache.naming.resources.FileDirContext.list(FileDirContext.java:885)
 at org.apache.naming.resources.FileDirContext.list(FileDirContext.java:306)
 at
org.apache.naming.resources.ProxyDirContext.list(ProxyDirContext.java:475)
 at
org.apache.catalina.startup.TldConfig.tldScanResourcePathsWebInf(TldConfig.j
ava:625)
 at
org.apache.catalina.startup.TldConfig.tldScanResourcePathsWebInf(TldConfig.j
ava:640)
 at
org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:59
4)
 at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:281)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4260)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
 at org.apache.catalina.core.StandardService.start(StandardService.java:476)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)


Other than this exception, the server process starts fine and runs without
issue.  I'd like to get NO exceptions during startup, especially seemingly
spurious SEVERE ones.

Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Session Listeners in separate context?

2004-04-02 Thread Ben Souther
Do sessionListeners reside in a different context from other servlets?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Session Listeners in separate context?

2004-04-02 Thread Ben Souther
Do sessionListeners reside in a different context from other servlets?
I'm trying to create a session listener that stores the sessions in a context scoped 
Object.  
For some reason, other servlets can't seem to access the the object.



/**
 * Adds a reference to the new session to the activeUsersList
 */
public void sessionCreated(HttpSessionEvent event){
HttpSession session  = event.getSession();   
ServletContext context   = session.getServletContext();
Hashtable activeUserList = (Hashtable)context.getAttribute(activeUserList);
if(activeUserList == null){   
activeUserList = new Hashtable();
}
activeUserList.put(session.getId(), session);
context.setAttribute(activeUserList, activeUserList);
}




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Session Listeners in separate context?

2004-04-02 Thread Shapira, Yoav

Hi,
No.  I don't know why the code you posted wouldn't work, it looks fine.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Ben Souther [mailto:[EMAIL PROTECTED]
Sent: Friday, April 02, 2004 2:59 PM
To: Tomcat Users List
Subject: Session Listeners in separate context?

Do sessionListeners reside in a different context from other servlets?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session Listeners in separate context?

2004-04-02 Thread Ben Souther
Thanks


On Friday 02 April 2004 03:07 pm, Shapira, Yoav wrote:
 Hi,
 No.  I don't know why the code you posted wouldn't work, it looks fine.

 Yoav Shapira
 Millennium Research Informatics

 -Original Message-

 From: Ben Souther [mailto:[EMAIL PROTECTED]

 Sent: Friday, April 02, 2004 2:59 PM
 To: Tomcat Users List
 Subject: Session Listeners in separate context?
 
 Do sessionListeners reside in a different context from other servlets?
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 This e-mail, including any attachments, is a confidential business
 communication, and may contain information that is confidential,
 proprietary and/or privileged.  This e-mail is intended only for the
 individual(s) to whom it is addressed, and may not be saved, copied,
 printed, disclosed or used by anyone else.  If you are not the(an) intended
 recipient, please immediately delete this e-mail from your computer system
 and notify the sender.  Thank you.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Ben Souther
F.W. Davison  Company, Inc.


This e-mail message, and any accompanying documents, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  Any unauthorized review, use, disclosure, distribution or
copying is prohibited.  If you are not the intended recipient, please
contact our office by email or by telephone at (508) 747-7261 and
immediately destroy all copies of the original message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Order of Filters Listeners

2004-02-06 Thread Wendy Smoak

It looks like SessionListener happens before Filters. 

I have a couple of Filters, after which there is a userid in session
scope.  I was hoping, in a SessionListener, to pick up that userid and
use it to read something from the database, but no dice since things
happen in the opposite order.

I went looking for a RequestListener, but I'm on Tomcat 4.1 right now,
and anyway for all I know that happens before the Filters also.

Right now it looks like I'll put in another Filter, even though this
stuff only needs to happen once per Session.

Other suggestions welcome!

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Order of Filters Listeners

2004-02-06 Thread Wendy Smoak
 From: Wendy Smoak 
 I have a couple of Filters, after which there is a userid in session
 scope.  I was hoping, in a SessionListener, to pick up that userid and
 use it to read something from the database, but no dice since things
 happen in the opposite order.

Ah, never mind.  (Not that anyone was listening, anyway. ;)  It turns
out that I need to do everything in a Filter so I can decide whether or
not the user is going to be allowed into the webapp.

-- 
Wendy Smoak

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: In memory session replication and session listeners?

2003-06-13 Thread Lawrence, Gabriel
Flip,

Got it. That's an easy, crafty way to do it. Will try it out and let you
know how it works. 

-gabe

-Original Message-
From: Filip Hanik [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2003 9:19 PM
To: Tomcat Users List
Subject: RE: In memory session replication and session listeners?

The session listener is only notified on the machine the value actually
gets
set.
Session data doesn't get replicated using the
setAttribute/removeAttribute
methods, but pure serialization.

And for now, the clustering doesn't have a public API to send your own
data
through it.
one way you an do it, is to implement the java.io.Externilizable
interface,
and when the data gets
deserialized, then set the stuff in your global variable, just remember
to
only set it once.

do you see where I am going with this?

Filip

 -Original Message-
 From: Lawrence, Gabriel [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 4:18 PM
 To: Tomcat Users List
 Subject: In memory session replication and session listeners?


 I'm using the tomcat 4 clustering stuff found at:

 http://cvs.apache.org/~fhanik/index.html

 And I have one issue. I have a service that tracks some information
that
 is reported outside the users session. This is examined by a different
 client then the users client. I want to keep this global information
in
 sync across my loadbalanced servers, as I can't necessarily predict
 which server the this different client is going to hit.

 The way it works without clustering is that I have a session listener
 set up that gets notified whenever data is added to a users session.
 This then triggers a update to my global store as well. What I think
I'm
 seeing is that when session information is replicated to my other
 server, the fact that something was set isn't triggering a session
 listener call on the other server. Does that mesh with peoples
 understanding?

 Is there a way I can get it to?

 Thanks!
 -gabe

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



In memory session replication and session listeners?

2003-06-12 Thread Lawrence, Gabriel
I'm using the tomcat 4 clustering stuff found at:

http://cvs.apache.org/~fhanik/index.html

And I have one issue. I have a service that tracks some information that
is reported outside the users session. This is examined by a different
client then the users client. I want to keep this global information in
sync across my loadbalanced servers, as I can't necessarily predict
which server the this different client is going to hit. 

The way it works without clustering is that I have a session listener
set up that gets notified whenever data is added to a users session.
This then triggers a update to my global store as well. What I think I'm
seeing is that when session information is replicated to my other
server, the fact that something was set isn't triggering a session
listener call on the other server. Does that mesh with peoples
understanding? 

Is there a way I can get it to?

Thanks!
-gabe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: In memory session replication and session listeners?

2003-06-12 Thread Filip Hanik
The session listener is only notified on the machine the value actually gets
set.
Session data doesn't get replicated using the setAttribute/removeAttribute
methods, but pure serialization.

And for now, the clustering doesn't have a public API to send your own data
through it.
one way you an do it, is to implement the java.io.Externilizable interface,
and when the data gets
deserialized, then set the stuff in your global variable, just remember to
only set it once.

do you see where I am going with this?

Filip

 -Original Message-
 From: Lawrence, Gabriel [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 4:18 PM
 To: Tomcat Users List
 Subject: In memory session replication and session listeners?


 I'm using the tomcat 4 clustering stuff found at:

 http://cvs.apache.org/~fhanik/index.html

 And I have one issue. I have a service that tracks some information that
 is reported outside the users session. This is examined by a different
 client then the users client. I want to keep this global information in
 sync across my loadbalanced servers, as I can't necessarily predict
 which server the this different client is going to hit.

 The way it works without clustering is that I have a session listener
 set up that gets notified whenever data is added to a users session.
 This then triggers a update to my global store as well. What I think I'm
 seeing is that when session information is replicated to my other
 server, the fact that something was set isn't triggering a session
 listener call on the other server. Does that mesh with peoples
 understanding?

 Is there a way I can get it to?

 Thanks!
 -gabe

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Listeners

2003-03-15 Thread Ray Madigan
Does anyone know of a technology where i can setup a listener
so a session can get notified when a foreigh event occurs.  The
situation I am working on is a EJB Application server wants to
notify a session in a webserver that a specific change has been
made.  If I can do this it will make the job of cacheing objects
on the webserver much simplier.

Thanks in Advance
Ray Madigan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Listeners

2003-03-15 Thread Filip Hanik
have you looked at jms?

Filip

-Original Message-
From: Ray Madigan [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 11:19 AM
To: Tomcat-User
Subject: Listeners


Does anyone know of a technology where i can setup a listener
so a session can get notified when a foreigh event occurs.  The
situation I am working on is a EJB Application server wants to
notify a session in a webserver that a specific change has been
made.  If I can do this it will make the job of cacheing objects
on the webserver much simplier.

Thanks in Advance
Ray Madigan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Listeners

2003-03-15 Thread Ray Madigan
I have, and i have a primitive implementation of jms working.  
I was looking at the connector technology and was wondering 
if it or any other technology could be used to connect and 
utilize its loadbalancing mechanism?

-Original Message-
From: Filip Hanik [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 12:11 PM
To: Tomcat Users List
Subject: RE: Listeners


have you looked at jms?

Filip

-Original Message-
From: Ray Madigan [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 11:19 AM
To: Tomcat-User
Subject: Listeners


Does anyone know of a technology where i can setup a listener
so a session can get notified when a foreigh event occurs.  The
situation I am working on is a EJB Application server wants to
notify a session in a webserver that a specific change has been
made.  If I can do this it will make the job of cacheing objects
on the webserver much simplier.

Thanks in Advance
Ray Madigan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Listeners

2003-03-15 Thread Filip Hanik
there are clustered jms implementations out there, that will allow your
server to fail over and all the other good stuff.

if you want events, then jms is the best offer,

Filip

-Original Message-
From: Ray Madigan [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 12:44 PM
To: Tomcat Users List
Subject: RE: Listeners


I have, and i have a primitive implementation of jms working.
I was looking at the connector technology and was wondering
if it or any other technology could be used to connect and
utilize its loadbalancing mechanism?

-Original Message-
From: Filip Hanik [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 12:11 PM
To: Tomcat Users List
Subject: RE: Listeners


have you looked at jms?

Filip

-Original Message-
From: Ray Madigan [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 11:19 AM
To: Tomcat-User
Subject: Listeners


Does anyone know of a technology where i can setup a listener
so a session can get notified when a foreigh event occurs.  The
situation I am working on is a EJB Application server wants to
notify a session in a webserver that a specific change has been
made.  If I can do this it will make the job of cacheing objects
on the webserver much simplier.

Thanks in Advance
Ray Madigan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Servlet/Session/Attribute Listeners not very useful ?

2002-12-29 Thread Jason Jonas - ATTBI
Jon,

I've used the SessionListener interface once to write usage stats to a
database when a user logs out explicitly or implicitly when the
session times out. Haven't used it since and not too sure if I would
again. However, the mechanism worked well enough to satisfy our
requirement.

If you're trying to access your application objects bound into the
session, perhaps you could wrap them in a single application object.
While this is a kludge, it means the object references are readily
available and would eliminate the IllegalStateExceptions you're
encountering now. Just a thought.

Jason

-Original Message-
From: Jon Eaves [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 28, 2002 6:08 AM
To: Tomcat Users List
Subject: Servlet/Session/Attribute Listeners not very useful ?

Hi all,

Can anybody tell me what possible use these particular interfaces
are ?

After thinking that they would be a good idea to use for web app
session management enhancements (session timeout etc) it turns out
that the invocations of valueUnbound(), sessionDestroyed(),
attributeRemoved() all occur _after_ the event has occurred, and
the values that would possibly be useful are all gone throwning
IllegalStateExceptions left right and centre.

What gives ? Did the Servlet Spec people have some other use for
these Interfaces that I'm not smart enough to work out, or are
they only useful for printing object added|removed|replaced
without being able to actually obtain the object?

The specifications for 2.4 for javax.servlet.http.HttpSession
still say the same things as 2.3, and if implemented in the
same way don't appear to be useful at all

Or is there some special magic that I'm not invoking the right
way ?

Help me, I'm confused ..

Cheers,
-- jon

--
Jon Eaves [EMAIL PROTECTED]
http://www.eaves.org/jon/


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Servlet/Session/Attribute Listeners not very useful ?

2002-12-29 Thread Jon Eaves
Jason Jonas - ATTBI wrote:

Jon,


Hi Jason,



I've used the SessionListener interface once to write usage stats to a
database when a user logs out explicitly or implicitly when the
session times out. Haven't used it since and not too sure if I would
again. However, the mechanism worked well enough to satisfy our
requirement.


Yeah. That is also a use. Again, it's anonymous in that you can't
identify exactly what session expired, just that a session expired.



If you're trying to access your application objects bound into the
session, perhaps you could wrap them in a single application object.
While this is a kludge, it means the object references are readily
available and would eliminate the IllegalStateExceptions you're
encountering now. Just a thought.


It's more that I want to clean up some application wide data
when the session expires. I can't even work out how to map the
session that has just expired to anything useful either. If I
could get the session id of the session that expired then it
could store the information in application scope and use the ID
as a key.

From my reading of the Servlet Specs and the API documentation it
appears that the intention of the expert group was along those
lines, but it doesn't seem to have carried through in the
implementation.

SRV.10.7 Session Events
Listener classes provide the developer with a way of tracking sessions
within a web application. ... session became invalid because the
container timed out the session, or because a web component .. called
the invalidate() method. The disctinction may be determined indirectly
using listeners and the HTTPSession API methods

and

javax.servlet.http.HttpSessionListener

public void sessionDestroyed(HttpSessionEvent se)

Notification that a session was invalidated.

javax.servlet.http.HttpSessionEvent only has 1 method, to get the
session. Which at that time is invalid.

I might have to try some more obscure options like trying to use
an HttpSessionAttributeListener and the HttpSessionBindingEvent to
see if when a session is invalidated a BindingEvent is emitted.
I'm not thinking I'm going to be all that successful though.

I was half hoping that Craig might be able clarify after he's finished
with his Festive cheer ;-)

Cheers,
	-- jon



Jason

-Original Message-
From: Jon Eaves [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 28, 2002 6:08 AM
To: Tomcat Users List
Subject: Servlet/Session/Attribute Listeners not very useful ?

Hi all,

Can anybody tell me what possible use these particular interfaces
are ?

After thinking that they would be a good idea to use for web app
session management enhancements (session timeout etc) it turns out
that the invocations of valueUnbound(), sessionDestroyed(),
attributeRemoved() all occur _after_ the event has occurred, and
the values that would possibly be useful are all gone throwning
IllegalStateExceptions left right and centre.

What gives ? Did the Servlet Spec people have some other use for
these Interfaces that I'm not smart enough to work out, or are
they only useful for printing object added|removed|replaced
without being able to actually obtain the object?

The specifications for 2.4 for javax.servlet.http.HttpSession
still say the same things as 2.3, and if implemented in the
same way don't appear to be useful at all

Or is there some special magic that I'm not invoking the right
way ?

Help me, I'm confused ..

Cheers,
-- jon

--
Jon Eaves [EMAIL PROTECTED]
http://www.eaves.org/jon/


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
Jon Eaves [EMAIL PROTECTED]
http://www.eaves.org/jon/



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Servlet/Session/Attribute Listeners not very useful ?

2002-12-28 Thread Jon Eaves
Hi all,

Can anybody tell me what possible use these particular interfaces
are ?

After thinking that they would be a good idea to use for web app
session management enhancements (session timeout etc) it turns out
that the invocations of valueUnbound(), sessionDestroyed(),
attributeRemoved() all occur _after_ the event has occurred, and
the values that would possibly be useful are all gone throwning
IllegalStateExceptions left right and centre.

What gives ? Did the Servlet Spec people have some other use for
these Interfaces that I'm not smart enough to work out, or are
they only useful for printing object added|removed|replaced
without being able to actually obtain the object?

The specifications for 2.4 for javax.servlet.http.HttpSession
still say the same things as 2.3, and if implemented in the
same way don't appear to be useful at all

Or is there some special magic that I'm not invoking the right
way ?

Help me, I'm confused ..

Cheers,
	-- jon

--
Jon Eaves [EMAIL PROTECTED]
http://www.eaves.org/jon/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Do two listeners entail double context intialization ?

2002-10-04 Thread Wolfgang Stein

I want to enable non-enrypted HTTP-communication for most servlets
of a context, but also enforce HTTPS-communication for SOME
servlets of the same context.

I remember some postings about multiple connectors
entailing multiple context-intialization.
But i'm not able to find the postings again.

Was this a problem in Tomcat 3.2 or do i mix up something ?

Thanks in advance
Wolfgang

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Exception management in servlet listeners

2002-10-03 Thread Heligon Sandra

I use the new feature ServletContextListener of the Servlet specifications
2.3. 
I defined the following class: 
public final class XSS_ServletContextListener implements
ServletContextListener { 
private static ServletContext s_context = null; 
public void contextInitialized(ServletContextEvent arg0) {
 s_context = arg0.getServletContext(); 
try{ // Get the reference on a CORBA object reference 
SessionManager sessionManager =
SessionManager.getSingleInstance(); ... 
} 
catch (ExBadManagerName ex) 
{ } 
} 
I don't what to do when the exception ExBadManagerName occurs. I am trying
to define in the web.xml file of my application the following element 
error-page 
exception-typecom.mycompagny.ExBadManagerName /exception-type 
location/pages/errorPage.jsp/location 
/error-page 
but the page is not displayed. 
What can I do to inform the client if an exception occurs, the index.jsp
page of my application has not to be displayed. 
Thanks a lot in advance 




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Exception management in servlet listeners

2002-10-03 Thread Shapira, Yoav

Hi,

I use the new feature ServletContextListener of the Servlet
specifications
2.3.

Great!  So do I. ;)

I don't what to do when the exception ExBadManagerName occurs. I am
trying

Log it, for one.  Even if you don't have a logging system initialized,
you can use getServletContext().log(message, exception).  Email the
admins, for two.  

to define in the web.xml file of my application the following element
error-page
   exception-typecom.mycompagny.ExBadManagerName
/exception-type
   location/pages/errorPage.jsp/location
/error-page
but the page is not displayed.
What can I do to inform the client if an exception occurs, the
index.jsp
page of my application has not to be displayed.

When you're in the contextInitialized(sce) method, you don't have a
client yet.  You're not tied into the connector, and so the error-page
tags don't mean a thing.  

The idea is that the stuff done in contextInitialized(), and for that
matter, contextDestroyed(), is administrative / configuration
functionality that should not involve your users directly.  That code
should be very carefully written and tested, and should be among the
most reliable code in your system.  And your server startup and shutdown
should be tightly regulated and monitored.  You don't want your users
(think malicious...) to know how / when / where you initialize and
shutdown things.

I hope that makes sense ;)

Yoav Shapira
Millennium ChemInformatics


This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: Exception management in servlet listeners

2002-10-03 Thread Heligon Sandra

Thanks for your explanation, in fact the web application has to connect
to a back-end application server that centralizes data, access right etc...
The connection must be initialised only one time that is why I have placed
this code in ServletContextListener.
But if the application server is not start or an other communication
problem occurs the web application can not be started.

According to your councils I recorded the messages of the exceptions in a
file.  
(getServletContext().log(message, exception)).
But I do not know where this log is created.  
I use Tomcat4.0.3 and no directory log is created.  

In spite of this exception the index.jsp page is displayed.  
A page HTML Server ERROR should rather be displayed.  
How can I do that ?

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 17:00
To: Tomcat Users List
Subject: RE: Exception management in servlet listeners


Hi,

I use the new feature ServletContextListener of the Servlet
specifications
2.3.

Great!  So do I. ;)

I don't what to do when the exception ExBadManagerName occurs. I am
trying

Log it, for one.  Even if you don't have a logging system initialized,
you can use getServletContext().log(message, exception).  Email the
admins, for two.  

to define in the web.xml file of my application the following element
error-page
   exception-typecom.mycompagny.ExBadManagerName
/exception-type
   location/pages/errorPage.jsp/location
/error-page
but the page is not displayed.
What can I do to inform the client if an exception occurs, the
index.jsp
page of my application has not to be displayed.

When you're in the contextInitialized(sce) method, you don't have a
client yet.  You're not tied into the connector, and so the error-page
tags don't mean a thing.  

The idea is that the stuff done in contextInitialized(), and for that
matter, contextDestroyed(), is administrative / configuration
functionality that should not involve your users directly.  That code
should be very carefully written and tested, and should be among the
most reliable code in your system.  And your server startup and shutdown
should be tightly regulated and monitored.  You don't want your users
(think malicious...) to know how / when / where you initialize and
shutdown things.

I hope that makes sense ;)

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Please Help....Re: Listeners in the WARP Connector?

2002-02-08 Thread Mark R. Diggory



Mark R. Diggory wrote:


 I assume I would  need  to use a WebAppDeploy descriptor to map the 
 users directories to Tomcat, how would I do that for generic users 
 directories (~/public_html)?


 WebAppConnection warpConnection warp localhost:8008
 WebAppDeploy examples warpConnection /examples/
 WebAppDeploy manager warpConnection /manager/
 WebAppDeploy webdav warpConnection /webdav/


 Mark R. Diggory wrote:

 I've successflly set up tomcat to server user public_html directories 
 using the example in the docmentation.

 However, this doesn't seem to work as well when I try it through my 
 WARP connection.

 Is this possible? Any tips?

  !-- Define an Apache-Connector Service --
  Service name=Tomcat-Apache

Connector 
 className=org.apache.catalina.connector.warp.WarpConnector
 port=8008 minProcessors=5 maxProcessors=75
 enableLookups=true
 acceptCount=10 debug=0/

!-- Replace localhost with what your Apache ServerName is set 
 to --
Engine className=org.apache.catalina.connector.warp.WarpEngine
 name=Apache debug=0 appBase=webapps

!-- Attempt to define a default virtual host and a listener 
 to map the user dir's  through the apache connector--
  Host name=Apache debug=0 appBase=webapps unpackWARs=true
Listener className=org.apache.catalina.startup.UserConfig
directoryName=public_html
homeBase=/home/login
userClass=org.apache.catalina.startup.HomesUserDatabase/
/Host

/Engine

  /Service

 -Mark Diggory



 -- 
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





 -- 
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Listeners in the WARP Connector?

2002-02-07 Thread Mark R. Diggory

I've successflly set up tomcat to server user public_html directories 
using the example in the docmentation.

However, this doesn't seem to work as well when I try it through my WARP 
connection.

Is this possible? Any tips?

  !-- Define an Apache-Connector Service --
  Service name=Tomcat-Apache

Connector className=org.apache.catalina.connector.warp.WarpConnector
 port=8008 minProcessors=5 maxProcessors=75
 enableLookups=true
 acceptCount=10 debug=0/

!-- Replace localhost with what your Apache ServerName is set 
to --
Engine className=org.apache.catalina.connector.warp.WarpEngine
 name=Apache debug=0 appBase=webapps

!-- Attempt to define a default virtual host and a listener to 
map the user dir's  through the apache connector--
  Host name=Apache debug=0 appBase=webapps unpackWARs=true
Listener className=org.apache.catalina.startup.UserConfig
directoryName=public_html
homeBase=/home/login
userClass=org.apache.catalina.startup.HomesUserDatabase/
/Host

/Engine

  /Service

-Mark Diggory



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Listeners in the WARP Connector?

2002-02-07 Thread Mark R. Diggory


I assume I would  need  to use a WebAppDeploy descriptor to map the 
users directories to Tomcat, how would I do that for generic users 
directories (~/public_html)?


WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
WebAppDeploy manager warpConnection /manager/
WebAppDeploy webdav warpConnection /webdav/


Mark R. Diggory wrote:

 I've successflly set up tomcat to server user public_html directories 
 using the example in the docmentation.

 However, this doesn't seem to work as well when I try it through my 
 WARP connection.

 Is this possible? Any tips?

  !-- Define an Apache-Connector Service --
  Service name=Tomcat-Apache

Connector 
 className=org.apache.catalina.connector.warp.WarpConnector
 port=8008 minProcessors=5 maxProcessors=75
 enableLookups=true
 acceptCount=10 debug=0/

!-- Replace localhost with what your Apache ServerName is set 
 to --
Engine className=org.apache.catalina.connector.warp.WarpEngine
 name=Apache debug=0 appBase=webapps

!-- Attempt to define a default virtual host and a listener to 
 map the user dir's  through the apache connector--
  Host name=Apache debug=0 appBase=webapps unpackWARs=true
Listener className=org.apache.catalina.startup.UserConfig
directoryName=public_html
homeBase=/home/login
userClass=org.apache.catalina.startup.HomesUserDatabase/
/Host

/Engine

  /Service

 -Mark Diggory



 -- 
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]