You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kyle Aaron <aa...@ldschurch.org> on 2003/11/21 00:46:13 UTC

RequestProcessor.processForwardConfig changes

I am working on updating struts from 1.1beta3 to 1.1 release. In doing this I ran into a problem. I tracked the problem down to one method. In the class org.apache.struts.action.RequestProcessor the release version of processForwardConfig looks like this�

    protected void processForwardConfig(HttpServletRequest request,
                                        HttpServletResponse response,
                                        ForwardConfig forward)
        throws IOException, ServletException {

        if (forward == null) {
            return;
        }
        
        if (log.isDebugEnabled()) {
            log.debug("processForwardConfig(" + 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()) {
            // only prepend context path for relative uri
            if (uri.startsWith("/")) {
                uri = request.getContextPath() + uri;
            }
            response.sendRedirect(response.encodeRedirectURL(uri));
            
        } else {
            doForward(uri, request, response);
        }

    }


The 1.1beta3 version of this method looks like�.


        protected void processForwardConfig(HttpServletRequest request,
                                        HttpServletResponse response,
                                        ForwardConfig forward)
        throws IOException, ServletException {

        if (forward == null) {
            return;
        }
        
        if (log.isDebugEnabled()) {
            log.debug("processForwardConfig(" + forward + ")");
        }
        
        String uri = RequestUtils.forwardURL(request, forward);
        if (forward.getRedirect()) {
            response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + uri));
        } else {
            doForward(uri, request, response);
        }

    }



I was not using a forward slash ('/') in the path attribute of the forward (see below). Because of this I could not get to any of my web pages (and all of my cactus tests failed).

The forward in the action mapping look something like�
      <forward name="Success"
        path="xmlcview"
        redirect="false"/>

To use the release version of struts, the forward needs to look like�
      <forward name="Success"
        path="/xmlcview"
        redirect="false"/>

I am wondering if the change to processForwardConfig() is final or if something was overlooked and the change needs to be reconsidered? 

Thank you,

-Kyle



------------------------------------------------------------------------------
This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed.


==============================================================================


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