tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Liam Morley <lmor...@gdc.wpi.edu>
Subject repost: troubles writing a filter to intercept session cookies
Date Wed, 26 Jun 2002 04:00:01 GMT
NOTE:
After posting to the Tomcat Users list, I've posted this in a few online 
forums without getting a single response. Either nobody knows the 
answer, or I'm wording this incorrectly.. but if nobody here knows the 
answer, the only other thing I can think of is to post to tomcat-dev.

the original email is as follows:

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.


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message