You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Liam Morley <lm...@gdc.wpi.edu> on 2002/06/19 20:48:20 UTC

problems writing a filter

  I'd like to set the path for a JSESSIONID cookie belonging to one of 
the webapps to "/" instead of "/my_webapp", as sessions are getting lost 
when I have to rewrite the url with mod_rewrite. I had been told that I 
can write a javax.servlet.Filter and a 
javax.servlet.http.HttpServletResponseWrapper to do this. This is 
working to some degree; a request comes in, and when the 
response.addCookie() method is called, I can change the path. In 
web.xml, I just have to add a <filter> element which contains the 
location of my java class and make sure I map it to the correct servlet.

I have one problem: the code is not being called the first time the page 
is requested. However, the JSESSIONID cookie is still getting added from 
somewhere; I'm just not sure where. This is rather curious, to say the 
least. What results is a cookie with a path of "/my_webapp" after the 
first request, and a second cookie with a path of "/" after any other 
request. Does anybody have any idea of why this is? I'm in desperate 
need of help:) I'd really like to change the path of the cookie on the 
FIRST request, not just each request thereafter.

Thanks,
Liam Morley


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>