On 19/05/2011 10:36, Micka wrote:
> Hi,
> 
> You should implents ServletContextListener to get the context () :
> 
> http://www.roseindia.net/servlets/ServletContextListener-example.shtml
> 
>     @Override
>     public void contextInitialized(ServletContextEvent arg0) {
>         if (context == null) {
>             context = arg0.getServletContext();
>         }
>     }
> 
> 
> 
> It works well in my case ;)

Nope. Won't work.

1. The OP wants Tomcat's Context object.
org.apache.catalina.Context != javax.servlet.ServletContext

2. The OP wants current sessions so a ServletContextListener that only
runs at context start and stop isn't going to help.

3. If the OP did want the ServletContext,
ServletRequest.getServletContext() is the way to go.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to