Use HttpServeletRequest.getContextPath() to get the context path.

-Tim

Daniel Watrous wrote:

Hello,

I am have written some filters for a shopcart application.  I intend
for parts of this applicaiton to be reused in other web applications
by including it as a JAR file.

For authentication I have the file AdministratorAuthFilter, which
checks for a session value indicating that the user has logged in. The trouble comes with the following line:


response.sendRedirect("/simplecart/AdministratorLogin.do");

My development application is simplecart and so when I deploy to
tomcat I have a URL like "http://localhost:8080/simplecart/"; which
serves as my root.  If I include this filter in another application as
part of a JAR that application will end up with another root, such as
"http://localhost:8080/mycart/";.  So the line above in my filter that
includes the literal "simplecart" breaks.

I have searched for something related to the context or context path.
All suggestions appreciated.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to