dgraham 2003/02/04 21:30:13 Modified: src/share/org/apache/struts/action RequestProcessor.java Log: Fix absolute uri forwarding and redirecting for PR# 11021 Revision Changes Path 1.25 +24 -9 jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java Index: RequestProcessor.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- RequestProcessor.java 30 Jan 2003 17:58:13 -0000 1.24 +++ RequestProcessor.java 5 Feb 2003 05:30:13 -0000 1.25 @@ -406,7 +406,7 @@ /** * Forward or redirect to the specified destination, by the specified * mechanism. - * This method uses the 1.1b2 ForwardConfig object. It should be used in + * This method uses the ForwardConfig object. It should be used in * place of processActionForward(...). * * @param request The servlet request we are processing @@ -424,14 +424,29 @@ if (forward == null) { return; } + if (log.isDebugEnabled()) { log.debug("processForwardConfig(" + forward + ")"); } - - String uri = RequestUtils.forwardURL(request, forward); + + String forwardPath = forward.getPath(); + String uri = null; + + // paths not starting with / should be passed through without any processing + // (ie. they're absolute) + if (forwardPath.startsWith("/")) { + uri = RequestUtils.forwardURL(request, forward); // get module relative uri + } else { + uri = forwardPath; + } + if (forward.getRedirect()) { - response.sendRedirect - (response.encodeRedirectURL(request.getContextPath() + uri)); + // only prepend context path for relative uri + if (uri.startsWith("/")) { + uri = request.getContextPath() + uri; + } + response.sendRedirect(response.encodeRedirectURL(uri)); + } else { doForward(uri, request, response); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]