tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Can you get the webapp context path from the javax.servlet API?
Date Fri, 21 Jul 2000 00:33:47 GMT
Is something wrong with request.getContextPath() for this?  It's part of the standard servlet
2.2 API.


Michael Taylor wrote:

> I had some really big problems with the implementation of jsp:include failing
> from a JSP to a servlet, so I wrote my own include tag.
> I need to know if there is a way to get the context path from without creating
> a dependency on tomcat.  If my web-app context is /foo and I want to convert a
> URL relative to the current context back into an external URL with the full
> syntax, then I have to make the following call at this point:
> ((org.apache.tomcat.core.ServletContextFacade)pageContext.getServletContext()).getRealContext().getPath();
> I also think I ocould do it with
> ((org.apache.tomcat.core.HttpServletRequestFacade)RequestpageContext.getRequest()).getRealRequest().getContext().getPath();
> It seems to me that this is a simple enough thing to get the /foo portion of
> the path back out of the Servlet engine, but I can't find this anywhere.
> Thanks for the help,
> Mike Taylor
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message