tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wall" <>
Subject Re: SOLVED: How to get the context path for a web application?
Date Tue, 10 Aug 2004 17:27:00 GMT
> Someone on the list suggested Request.getContextPath() and it works like a
> charm. Thanks to all.

Agreed, but my follow-up question was if there was such a call to be done
using a ServletContext/ServletConfig object so that you can get the context
path in initialization servlets, etc., before a request comes in.


> >> A ServletConfig reference is passed in the call to the init() method of
> > your
> >> servlet. From this you may use the getServletContext() method to get
> >> context. One thing to remember is that this does not get called until
> >> servlet is initialized and would be invalidated when it is destroyed. I
> > suggest
> >> you check the API docs for more information.
> >
> > But do any of those return the context path?  I didn't see it anywhere
> > the javadocs.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message