tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Taylor <mtay...@emeraldcave.net>
Subject Can you get the webapp context path from the javax.servlet API?
Date Thu, 20 Jul 2000 23:29:44 GMT
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
mdt@qad.com

Mime
View raw message