tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Alonso Vega <los...@unavarra.es>
Subject Re: Retrieve certain session data inside a servlet
Date Fri, 02 Jun 2006 09:15:03 GMT
Bob,

 Thanks for the reply. My problem is that the session info I need is not 
of the session that makes the request. I need to check other sessions in 
the same context.  I can use the request because it is in the same 
context, so the manager is the same.

This servlet is called internally from the app, and checks if some 
session exists. It is similar to the case of obtaining all active 
sessions from one context using the manager inside the servlet code 
(findSessions). If someone have this piece of code (or similar), it will 
serve me.

Regards

Carlos


Bob Hall escribió:

>--- Carlos Alonso Vega <losalo@unavarra.es> wrote:
>
>  
>
>>I am trying to obtain data about a session inside a
>>servlet, the code 
>>seems to be simple as
>>
>>localSession =
>>Ctx.getManager().findSession(sessionId);
>>
>>My problem is that I do not know how to obtain the
>>Ctx object from a 
>>request (HttpServletRequest)
>>
>>Thanks in advance
>>
>>    
>>
>
>Carlos,
>
>To obtain the HttpSession for the current request:
>
>HttpSession sess = req.getSession();
>    OR
>boolean create = false;  (or true)
>HttpSession sess = req.getSession(create);
>
>HTH,
>Bob
>  
>















---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message