Revision: 596
          http://stripes.svn.sourceforge.net/stripes/?rev=596&view=rev
Author:   bengunter
Date:     2007-07-26 17:48:19 -0700 (Thu, 26 Jul 2007)

Log Message:
-----------
The previous change broke processing of default values for URI parameters. This 
change fixes that and achieves the same goal.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java     
2007-07-26 19:51:54 UTC (rev 595)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java     
2007-07-27 00:48:19 UTC (rev 596)
@@ -289,21 +289,10 @@
             rewrite = binding != null && binding.getParameters().size() > 0;
         }
 
-        // if all that worked out to be true, then the URL needs to be 
rewritten
-        String relative = null;
+        StringBuilder url = null;
         if (rewrite) {
-            // get request URI sans the context path
-            int contextLength = request.getContextPath().length();
-            if (contextLength > 1)
-                relative = request.getRequestURI().substring(contextLength);
-            else
-                relative = request.getRequestURI();
-            rewrite = relative.length() > binding.getPath().length();
-        }
-
-        if (rewrite) {
             // append the binding parameters to the query string
-            StringBuilder url = new StringBuilder(binding.getPath());
+            url = new StringBuilder(binding.getPath());
             char separator = '?';
             for (UrlBindingParameter p : binding.getParameters()) {
                 String name = p.getName();
@@ -321,12 +310,16 @@
                     }
                 }
             }
+            rewrite = url.length() > binding.getPath().length();
+        }
 
+        if (rewrite) {
             // forward to rewritten request
             request.setAttribute(StripesConstants.REQ_ATTR_BYPASS_REWRITE, 
Boolean.TRUE);
             request.getRequestDispatcher(url.toString()).forward(request, 
response);
         }
         else {
+            // turn off the bypass flag
             request.removeAttribute(StripesConstants.REQ_ATTR_BYPASS_REWRITE);
         }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to