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/util RequestUtils.java
Date Wed, 24 Jul 2002 13:01:47 GMT
cedric      2002/07/24 06:01:46

  Modified:    src/test/org/apache/struts/util TestRequestUtils.java
               src/share/org/apache/struts/util RequestUtils.java
  Log:
  Re-enable automatic '/' prefix in forwardURL(...).
  Re-enable associated tests (passed successfully).
  Tiles now catch the forward path before the call to forwardURL(...).
  This should solve again bug 10534.
  
  Revision  Changes    Path
  1.9       +4 -12     jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java
  
  Index: TestRequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestRequestUtils.java	12 Jul 2002 09:51:57 -0000	1.8
  +++ TestRequestUtils.java	24 Jul 2002 13:01:46 -0000	1.9
  @@ -591,7 +591,6 @@
   
   
       // Default subapp -- Forward with relative path (non-context-relative)
  -    /* FIXME - comment out until Tiles conundrum is solved
       public void testComputeURL1f() {
   
           request.setPathElements("/myapp", "/action.do", null, null);
  @@ -609,11 +608,9 @@
                        "/myapp/relative.jsp",
                        url);
       }
  -    */
   
   
       // Default subapp -- Forward with relative path (context-relative)
  -    /* FIXME - comment out until Tiles conundrum is solved
       public void testComputeURL1g() {
   
           request.setPathElements("/myapp", "/action.do", null, null);
  @@ -631,7 +628,6 @@
                        "/myapp/relative.jsp",
                        url);
       }
  -    */
   
   
       // Second subapp -- Forward only
  @@ -749,7 +745,6 @@
   
   
       // Second subapp -- Forward with relative path (non-context-relative)
  -    /* FIXME - comment out until Tiles conundrum is solved
       public void testComputeURL2f() {
   
           request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  @@ -768,11 +763,9 @@
                        "/myapp/2/relative.jsp",
                        url);
       }
  -    */
   
   
       // Second subapp -- Forward with relative path (context-relative)
  -    /* FIXME - comment out until Tiles conundrum is solved
       public void testComputeURL2g() {
   
           request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  @@ -791,7 +784,6 @@
                        "/myapp/relative.jsp",
                        url);
       }
  -    */
   
   
       // Add parameters only
  
  
  
  1.49      +13 -14    jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- RequestUtils.java	12 Jul 2002 15:47:01 -0000	1.48
  +++ RequestUtils.java	24 Jul 2002 13:01:46 -0000	1.49
  @@ -1172,15 +1172,18 @@
   
       }
   
  -
       /**
        * Return the context-relative URL that corresponds to the specified
        * {@link ForwardConfig}, relative to the module associated
  -     * with the current {@link ApplicationConfig}.
  +     * with the current {@link ApplicationConfig}. The forward path is
  +     * gracefully prefixed with a '/' according to the boolean
  +     *
        *
        * @param request The servlet request we are processing
        * @param forward ForwardConfig to be evaluated
  -     *
  +     * @param slashPrefixed If true, method takes care to prefix the forward path
  +     * URL with a '/' if needed. If false, the '/' is added only if forward
  +     * path is used after another prefix.
        * @since Struts 1.1b2
        */
       public static String forwardURL(HttpServletRequest request,
  @@ -1191,11 +1194,9 @@
           // Handle a ForwardConfig marked as context relative
           StringBuffer sb = new StringBuffer();
           if (forward.getContextRelative()) {
  -            /* Disabled to let Tiles definition names unchanged !
  -            if (!path.startsWith("/")) {
  +            if ( !path.startsWith("/") ) {
                   sb.append("/");
               }
  -            */
               sb.append(path);
               return (sb.toString());
           }
  @@ -1208,11 +1209,10 @@
           if (forwardPattern == null) {
               // Performance optimization for previous default behavior
               sb.append(appConfig.getPrefix());
  -            /* Disabled to let Tiles definition names unchanged !
  +            // smoothly insert a '/' if needed
               if (!path.startsWith("/")) {
                   sb.append("/");
               }
  -            */
               sb.append(path);
           } else {
               boolean dollar = false;
  @@ -1224,11 +1224,10 @@
                           sb.append(appConfig.getPrefix());
                           break;
                       case 'P':
  -                        /* Disabled to let Tiles definition names unchanged !
  +                        // add '/' if needed
                           if (!path.startsWith("/")) {
                               sb.append("/");
                           }
  -                        */
                           sb.append(path);
                           break;
                       case '$':
  
  
  

--
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