Thanks! I'm looking through JMX (I don't nothing about it), but meanwhile, can anyone tell me how to access the Context through JMX?
On 19 May 2011 11:41, Mark Thomas <ma...@apache.org> wrote: > 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 > >