You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/11/12 20:56:55 UTC

DO NOT REPLY [Bug 24657] New: - Context-relative redirects duplicate context-root in URL (in WAS)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24657>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24657

Context-relative redirects duplicate context-root in URL (in WAS)

           Summary: Context-relative redirects duplicate context-root in URL
                    (in WAS)
           Product: Struts
           Version: 1.1 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Controller
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: anders.wisch@kp.org


I'm using WSAD 5.1, WAS 4.0.6 Test Server.

The context-root of my web application as defined in my EAR's deployment
descriptor is "my_app". To test my application, I navigate to:

http://localhost:8080/my_app/

I've got the following global forward in the struts-config.xml for moduleA:

<forward name="my_forward" redirect="true" contextRelative="true" 
path="/moduleB/action.do">
</forward>

When my action in moduleA returns the ActionForward defined as "my_forward",
the browser is redirected to:

http://localhost:8080/my_app/my_app/moduleB/action.do

Since the global forward is a redirect and context relative, the forward
path ("/moduleB/action.do") remains unmolested until it reaches this bit
of Struts code in
RequestProcessor.processForwardConfig(HttpServletRequest request,
                                      HttpServletResponse response,
                                      ForwardConfig forward):

if (forward.getRedirect()) {
    // only prepend context path for relative uri
    if (uri.startsWith("/")) {
        uri = request.getContextPath() + uri;
    }
    response.sendRedirect(response.encodeRedirectURL(uri));        

}

The URI passed in to response.encodeRedirectURL is "/my_app/moduleB/action.do"
since we've prepended the original forward path with the context path. The 
problem
seems to be that response.encodeRedirectURL prepends the URI with not only the
scheme, server, port, etc., but also with same context path.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org