"Nilesh Bansal" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> hi all,
>
> I want to know if Tomcat (servlet api) provides some way by which a
> Java method can get session information or page context associated
> with the current executing thread?
>
The short answer is no:  Tomcat out-of-the-box doesn't provide this type of 
functionality

> Inside a JSP or a class implementing HttpServlet, one can easily get
> the page context and session information. But is there some static
> helper function which can return the same information for the current
> executing thread? I don't want to pass the pageContext as an
> additional variable to all method calls in JSP.
>
Long answer:  There is nothing to prevent you from creating you a static 
ThreadLocal and storing whatever information you need in that.  If you don't 
actually need the pageContext, then a simple Filter could be used to set 
this information up.

> DWR for example provides the following for all DWR requests:
> WebContext webContext = WebContextFactory.get();  // get() is a static 
> function
> HttpSession session = webContext.getHttpServletRequest().getSession();
>
> thanks
> Nilesh
>
> -- 
> Nilesh Bansal
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 




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

Reply via email to