You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ma...@centrum.cz on 2010/07/23 16:33:43 UTC

getting StandardContext in Tomcat 7

Hello
In Tomcat 6 I was using this code to get StandardContext:
        StandardEngine engine = (StandardEngine) ServerFactory.getServer().findService("Catalina").getContainer();
        StandardContext context = (StandardContext) engine.findChild(engine.getDefaultHost()).findChild(getPortalContext());

but this is no more working in Tomcat 7, because ServerFactory was removed.

My code was inspired by this HowTo:
http://wiki.apache.org/tomcat/HowTo#How_do_I_get_direct_access_to_a_Tomcat_Realm.3F

Does anyone have idea how to get StandardContext instance in Tomcat 7?

Thank you
Martin

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


Re: getting StandardContext in Tomcat 7

Posted by Mark Thomas <ma...@apache.org>.
On 23/07/2010 15:33, martin.sznapka@centrum.cz wrote:
> 
> Hello
> In Tomcat 6 I was using this code to get StandardContext:
>         StandardEngine engine = (StandardEngine) ServerFactory.getServer().findService("Catalina").getContainer();
>         StandardContext context = (StandardContext) engine.findChild(engine.getDefaultHost()).findChild(getPortalContext());
> 
> but this is no more working in Tomcat 7, because ServerFactory was removed.
> 
> My code was inspired by this HowTo:
> http://wiki.apache.org/tomcat/HowTo#How_do_I_get_direct_access_to_a_Tomcat_Realm.3F
> 
> Does anyone have idea how to get StandardContext instance in Tomcat 7?

You should be able to go via the MBean server.

Mark



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