tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RocketRonz <>
Subject Adding contextPath to request using a Valve
Date Wed, 30 Jul 2008 16:51:57 GMT

I'm trying to automatically assign a context path to requests from a specific
URL using a Valve, so in the following example code requests to the URL should hit my <Context> in server.xml with the path
"/site2" :

public void invoke(Request request, Response response) throws, javax.servlet.ServletException {
	if(request.getRequestURL().indexOf("") != -1) {
		System.out.println("Context path set to " + request.getContextPath());
	getNext().invoke(request, response);

The system out is being called so I would have expected the same behaviour
that I get when I type into the browser. However,
the default <Context> is being hit.

Is this something anyone has tried to do using a Valve or is there any
better way to achieve this kind of behaviour. Any advice would be very much

View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message