As conclusion on my "redirect" troubles :

I've made some test on WAS to understand the behaviour of it's
response.sendRedirect implementation.

If path used begins with "/", WAS builds an absolute URL considering root as
WEBAPP CONTEXT (and not Servlet container root as servlet API defines the
behaviour).

So, on WAS, Struts does not require to add context to the redirected URL
when using a "redirect=true" forward. If you use an absolute URL as path
(with protocol://server:port ...) WAS uses it.

To use Struts redirect option on WAS, you just have to comment this two
lines in an dedicated Servlet (that extens ActionServlet) :
// if (path.startsWith("/"))
//     path = request.getContextPath() + path;

If you don't want to have a WAS specific servlet, you can use this code in
an extended ActionServlet (Struts 1.0.2) or RequestProcessor (Struts 1.1) :

if (path.startsWith('/')) {
    // build a absolute URL to the path
    path = request.getScheme() + "://"
            + request.getServerName()
            + ":" + request.getServerPort()
            + request.getContextPath()
            + path
}
response.sendRedirect(response.encodeRedirectURL(path));


Nico


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to