Howdy,

>Thanks ! We do plan to update our tomcat versions from time to time. If
you
>can enlighten me as to why this code would break on the future
versions,
>may
>be I can have a work around?

Because these are internal tomcat classes, there is no guarantee that
their behavior will stay the same.  Even if the interfaces (e.g.
Manager) stay the same, the implementations may change in name or
function or both.  So casting getManager() to StandardManager is not
guaranteed to work in the future.  Calling
StandardManager#findSessions() in the future may work different than it
does now.

Work around?  Don't even go down this path of tying your webapp to
tomcat's internal classes.  Program your webapp to the Servlet
Specification and API, that's why it's there.  There have been numerous
discussions in the past on this list on how to keep track of sessions in
a container-independent way: search the archives.

Yoav Shapira

>
>Thanks !
>
>Kailas
>Enterprise Web Infrastructure
>
>
>-----Original Message-----
>From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
>Sent: Thursday, October 02, 2003 3:52 PM
>To: Tomcat Users List
>Subject: RE: Accessing Sessions in the container
>
>
>
>Howdy,
>Which line is the exception on?  Have you tried adding one more cast,
the
>of
>the context to the catalina context (as opposed to the normal
>javax.servlet.ServletContext)?  Then doing context.getManager...
>
>BTW, do you ever plan on updating your tomcat versions?  You're aware
this
>code may break with future versions of tomcat, right?
>
>Yoav Shapira
>Millennium ChemInformatics
>
>
>>-----Original Message-----
>>From: Simha, Kailas [mailto:[EMAIL PROTECTED]
>>Sent: Thursday, October 02, 2003 3:48 PM
>>To: 'Tomcat Users List'
>>Subject: RE: Accessing Sessions in the container
>>
>>Well,  I have it in the import. But here is the code snippet. Am I
>doing
>>anything wrong here?
>>Thanks a lot for your help !
>>
>>public void doGet(HttpServletRequest request, HttpServletResponse
>response)
>>                                      throws IOException,
>ServletException
>>{
>>
>>              org.apache.catalina.HttpRequest req =
>>(org.apache.catalina.HttpRequest)request;
>>              StandardManager manager =
>>(StandardManager)req.getContext().getManager();
>>              Session[] sessions = manager.findSessions();
>>
>>}
>>
>>
>>Kailas
>>Enterprise Web Infrastructure
>>
>>
>>-----Original Message-----
>>From: Filip Hanik [mailto:[EMAIL PROTECTED]
>>Sent: Thursday, October 02, 2003 3:43 PM
>>To: Tomcat Users List
>>Subject: Re: Accessing Sessions in the container
>>
>>
>>import org.apache.catalina.Session;
>>
>>that is the Session you will be getting back from findSessions
>>
>>----- Original Message -----
>>From: "Simha, Kailas" <[EMAIL PROTECTED]>
>>To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
>>Sent: Thursday, October 02, 2003 12:32 PM
>>Subject: RE: Accessing Sessions in the container
>>
>>
>>This gives me a class cast exception when running !
>>Thanks !
>>
>>Kailas
>>Enterprise Web Infrastructure
>>
>>
>>-----Original Message-----
>>From: Filip Hanik [mailto:[EMAIL PROTECTED]
>>Sent: Thursday, October 02, 2003 3:05 PM
>>To: Tomcat Users List
>>Subject: Re: Accessing Sessions in the container
>>
>>
>>put a Valve in your context and you can do all kinds of things there
>>
>>on the invoke you can do
>>
>>StandardManager manager =
>>(StandardManager)request.getContext().getManager();
>>Session[] sessions = manager.findSessions();
>>
>>the valve if configured only to one context to so you will only get
one
>>manager, ie one webapp
>>
>>Filip
>>
>>----- Original Message -----
>>From: "Tim Funk" <[EMAIL PROTECTED]>
>>To: "Tomcat Users List" <[EMAIL PROTECTED]>
>>Sent: Thursday, October 02, 2003 11:56 AM
>>Subject: Re: Accessing Sessions in the container
>>
>>
>>But that restriction can be bypssed by creating a SessionListener to
>store
>>these sessions yourself in ServletContext scope. Search the archive
for
>>more info about this.
>>
>>Doing so can also easily create a memory leak if one is not careful.
>>
>>-Tim
>>
>>Filip Hanik wrote:
>>
>>> prohibited by spec
>>>
>>> Filip
>>>
>>> ----- Original Message -----
>>> From: "Simha, Kailas" <[EMAIL PROTECTED]>
>>> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
>>> Sent: Thursday, October 02, 2003 11:50 AM
>>> Subject: Accessing Sessions in the container
>>>
>>>
>>> Hi all,
>>> How would I be able to access/list all the sessions running on a
>>> JVM/Container? Any sample code would be delightfully welcome! Thanks
>>> in advance, Kailas
>>>
>>>
>>>
---------------------------------------------------------------------
>>> 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]
>>
>>
>>
>>---------------------------------------------------------------------
>>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]
>
>
>
>
>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]
>
>
>
>---------------------------------------------------------------------
>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]

Reply via email to