I call Response.sendRedirect() from my servlet.

I'm sending the user back to the same servlet (the controller), so I use
Request.getRequestURI().toString().

Like so:
res.sendRedirect( req.getRequestURI().toString() + "?action=groups" );

On Tomcat 4 on NT the redirected URL looks correct:
"http://server/webapp/appname/Servlet?foo=bar";

On WebSphere 3.5 on OS/400 the redirected URL is wrong:
"http://server/webapp/appname/webapp/appname/Servlet?foo=bar";

In both containers, the value of req.getRequestURI().toString() is the same:
"/webapp/appname/Servlet" (perfect)

It seems that WebSphere is using "http://server/webapp/appname"; as the base
and is appending the request URI into it and producing the above result.

Tomcat is using "http://server"; as the base, so appending the request URI
produces the desired result.

My questions: Are both containers correct? Am I making an incorrect
assumption about what the base should be?

Any ideas?


I am considering workarounds like passing the entire URL (getRequestURL)
into the redirect instead of relative paths. I cannot use RequestDispather
in this situation.

--------------------
Kevin Baynes
Software Engineer
[EMAIL PROTECTED]
703-393-2191

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to