Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

troubles writing a filter to intercept session cookies

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
I'd like to set the path for a JSESSIONID cookie belonging to one of the webapps to &quot;/&quot; instead of &quot;/my_webapp&quot;, 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 &quot;/my_webapp&quot; after the first request, and a second cookie with a path of &quot;/&quot; 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. Liam Morley
lmorley@gdc.wpi.edu
&quot;light the deep, and bring silence to the world.
light the world, and bring depth to the silence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top