struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ced...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/action RequestProcessor.java
Date Fri, 19 Jul 2002 10:00:41 GMT
cedric      2002/07/19 03:00:41

  Modified:    src/share/org/apache/struts/action RequestProcessor.java
  Log:
  -Factorize "request forward" calls  just before uri is extended with module prefix.
  -Introduce following methods:
   - protected void processForwardConfig(...);
     same as processActionForward(...), but with the new ForwardConfig as parameter.
   - protected void internalModuleRelativeForward(String uri, HttpServletRequest request,
                               HttpServletResponse response)
        To perform a module relative forward. This method append the module prefix.
   - protected void internalModuleRelativeInclude(String uri, HttpServletRequest request,
                               HttpServletResponse response)
        To perform a module relative include. This method append the module prefix.
    Method whose names start with internal are intended to be not part of the API. They is
no
  guaranties that they will be left in the future. They are used by the Tiles
  RequestProcessor which is part of Struts core.
  
  - Change processActionForward(...) to call now processForwardConfig(...)
   - All methods doing a forward now use one of this 3 methods.
  
  Revision  Changes    Path
  1.16      +80 -27    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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RequestProcessor.java	9 Jul 2002 23:57:05 -0000	1.15
  +++ RequestProcessor.java	19 Jul 2002 10:00:41 -0000	1.16
  @@ -387,6 +387,23 @@
                                           HttpServletResponse response,
                                           ActionForward forward)
           throws IOException, ServletException {
  +    processForwardConfig( request, response, forward );
  +    }
  +    /**
  +     * Forward or redirect to the specified destination, by the specified
  +     * mechanism.
  +     *
  +     * @param request The servlet request we are processing
  +     * @param response The servlet response we are creating
  +     * @param forward The ForwardConfig controlling where we go next
  +     *
  +     * @exception IOException if an input/output error occurs
  +     * @exception ServletException if a servlet exception occurs
  +     */
  +    protected void processForwardConfig(HttpServletRequest request,
  +                                        HttpServletResponse response,
  +                                        ForwardConfig forward)
  +        throws IOException, ServletException {
   
           if (forward == null) {
               return;
  @@ -524,15 +541,7 @@
               return (true);
           }
   
  -        // Construct a request dispatcher for the specified path
  -        String uri = appConfig.getPrefix() + forward;
  -
  -        // Delegate the processing of this request
  -        // FIXME - exception handling?
  -        if (log.isDebugEnabled()) {
  -            log.debug(" Delegating via forward to '" + uri + "'");
  -        }
  -        doForward(uri, request, response);
  +        internalModuleRelativeForward(forward, request, response);
           return (false);
   
       }
  @@ -558,15 +567,7 @@
               return (true);
           }
   
  -        // Construct a request dispatcher for the specified path
  -        String uri = appConfig.getPrefix() + include;
  -
  -        // Delegate the processing of this request
  -        // FIXME - exception handling?
  -        if (log.isDebugEnabled()) {
  -            log.debug(" Delegating via include to '" + uri + "'");
  -        }
  -        doInclude(uri, request, response);
  +        internalModuleRelativeInclude(include, request, response);
           return (false);
   
       }
  @@ -925,18 +926,70 @@
           String uri = null;
           if (appConfig.getControllerConfig().getInputForward()) {
               ForwardConfig forward = mapping.findForward(input);
  -            uri = RequestUtils.forwardURL(request, forward);
  +            processForwardConfig( request, response, forward);
           } else {
  -            uri = appConfig.getPrefix() + input;
  +            internalModuleRelativeForward(input, request, response);
           }
  -        doForward(uri, request, response);
  +
           return (false);
   
       }
   
       /**
  +     * Do a module relative forward to specified uri using request dispatcher.
  +     * Uri is relative to the current module. The real uri is compute by prefixing
  +     * the module name.
  +     * This method is used internally and is not part of the public API. It is
  +     * advice to not use it in subclasses.
  +     * @param uri Module-relative URI to forward to
  +     * @param request Current page request
  +     * @param response Current page response
  +     * @since Struts 1.1
  +     */
  +    protected void internalModuleRelativeForward(String uri, HttpServletRequest request,
  +                             HttpServletResponse response)
  +        throws IOException, ServletException
  +    {
  +    // Construct a request dispatcher for the specified path
  +    uri = appConfig.getPrefix() + uri;
  +
  +    // Delegate the processing of this request
  +    // FIXME - exception handling?
  +    if (log.isDebugEnabled()) {
  +        log.debug(" Delegating via forward to '" + uri + "'");
  +    }
  +    doForward(uri, request, response);
  +    }
  +
  +    /**
  +     * Do a module relative include to specified uri using request dispatcher.
  +     * Uri is relative to the current module. The real uri is compute by prefixing
  +     * the module name.
  +     * This method is used internally and is not part of the public API. It is
  +     * advice to not use it in subclasses.
  +     * @param uri Module-relative URI to include
  +     * @param request Current page request
  +     * @param response Current page response
  +     * @since Struts 1.1
  +     */
  +    protected void internalModuleRelativeInclude(String uri, HttpServletRequest request,
  +                             HttpServletResponse response)
  +        throws IOException, ServletException
  +    {
  +    // Construct a request dispatcher for the specified path
  +    uri = appConfig.getPrefix() + uri;
  +
  +    // Delegate the processing of this request
  +    // FIXME - exception handling?
  +    if (log.isDebugEnabled()) {
  +        log.debug(" Delegating via include to '" + uri + "'");
  +    }
  +    doInclude(uri, request, response);
  +    }
  +
  +    /**
        * Do a forward to specified uri using request dispatcher.
  -     * This method is used by all internal method needi
  +     * This method is used by all internal method needing to do a forward.
        * @param uri Context-relative URI to forward to
        * @param request Current page request
        * @param response Current page response
  @@ -964,7 +1017,7 @@
   
       /**
        * Do an include of specified uri using request dispatcher.
  -     * This method is used by all internal method needi
  +     * This method is used by all internal method needing to do an include
        * @param uri Context-relative URI to include
        * @param request Current page request
        * @param response Current page response
  
  
  

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


Mime
View raw message