This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes redirecting servlet fails with embedded jsessionId Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "redirecting servlet fails with embedded jsessionId" Watch "redirecting servlet fails with embedded jsessionId" New topic
Author

redirecting servlet fails with embedded jsessionId

Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
I have some links on a home page that are called as follows:


When the user comes to the site for the first time (no cookie set yet), they get a jsessionId assigned. All pages are served by servlets. Most of the links work fine, but the ones that lead to a servlet that redirects to an https login page have the jsessionID embedded in their url. Thus, they break and I get a 404 error. Earlier, i was able to even see the home page's source that showed the embedded jsessionId, but I think my using the <html:link> tag fixed that.

Here is the header trace -- I'm at a loss as to why the jessionId is being made part of the URL when cookies are working fine:

This is the home page... working as it should. Cookie is set, and we're ok.


Now with the servlet that redirects to an https login page (with a redirect back to the referring page on success), I get this -- note the URL with jsessionId embedded.


Now the browser tries to get this bad url and fails...


Any thoughts on why this would occur, and what I can do to prevent it? My impression is that the Struts framework (1.3.10 is what I use) should handle the URL rewriting if I use the right tags... maybe I'm not?

I'm happy to post the redirect code, but I figure this post is long enough.
_R
Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
Oh, I should add that the appropriate action is that by calling https://www.mysite.com/storeIt/landing.s2s

I should be redirected to https://www.mysite.com/login.s2s?redirect="/storeIt/landing.s2s"

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: redirecting servlet fails with embedded jsessionId
 
Similar Threads
problem setting custom header in response
response.setHeader not working
Issue with Form Input in JSP Request with japaneese characters
doGet and doPost() difference
Request input stream