tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <novo...@gridsphere.org>
Subject using manager webapp programatically
Date Mon, 09 Oct 2006 23:33:26 GMT

Hi,

    I have a webapp (a portal) that sets the crossContext="true" and so 
can accesss other webapps in Tomcat. My goal is to do an include() on 
the manager webapp to show the deployed applications. Here is my code:

doGet(HttpServletRequest req, HttpServletResponse res) throws 
IOException, ServletException {

ServletContext context = ctx.getContext("/manager");   
context.getRequestDispatcher("/list").include(req, res);
       
}

Unfortunately I get the following:

FAIL - Unknown command /portal

I looked at the source code of the manager app and I see it has this line:

String command = request.getPathInfo();
        if (command == null)
            command = request.getServletPath();

So it looks like request.getPathInfo() is returning null so then it uses 
the getServletPath which returns my servlet path that is doing the 
dispatching, "portal" and not "/list" as I desire. Is that expected 
behaavior?

I finally "hacked" something together, where I have to pass in my own 
implementation of HttpServletRequest object in the include(),  where the 
getPathInfo returns a hardcoded "/list"-- it works but is a terrible 
hack. I'm wondering if there is a better way-- or maybe the manager 
webapp could be altered so that instead of doing request.getPathInfo it 
could do some kind of request.getParameter().. in which case the manager 
webapp would be invoked by doing /manager?command=list instead of 
/manager/list

    Thanks, Jason








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


Mime
View raw message