Revision: 1029
          http://stripes.svn.sourceforge.net/stripes/?rev=1029&view=rev
Author:   bengunter
Date:     2009-01-06 04:48:54 +0000 (Tue, 06 Jan 2009)

Log Message:
-----------
Fixed STS-632. Includes are handled properly when determining the value of 
_sourcePage.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
    trunk/stripes/src/net/sourceforge/stripes/util/HttpUtil.java

Modified: trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2008-12-23 
21:47:14 UTC (rev 1028)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2009-01-06 
04:48:54 UTC (rev 1029)
@@ -22,6 +22,7 @@
 import net.sourceforge.stripes.exception.StripesJspException;
 import net.sourceforge.stripes.util.CryptoUtil;
 import net.sourceforge.stripes.util.HtmlUtil;
+import net.sourceforge.stripes.util.HttpUtil;
 import net.sourceforge.stripes.util.Log;
 import net.sourceforge.stripes.util.UrlBuilder;
 import net.sourceforge.stripes.validation.ValidationErrors;
@@ -239,7 +240,7 @@
                 out.write(StripesConstants.URL_KEY_SOURCE_PAGE);
                 out.write("\" value=\"");
                 HttpServletRequest request = (HttpServletRequest) 
getPageContext().getRequest();
-                out.write(CryptoUtil.encrypt(request.getServletPath()));
+                
out.write(CryptoUtil.encrypt(HttpUtil.getRequestedServletPath(request)));
                 out.write("\" />");
 
                 if (isWizard()) {

Modified: trunk/stripes/src/net/sourceforge/stripes/util/HttpUtil.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/HttpUtil.java        
2008-12-23 21:47:14 UTC (rev 1028)
+++ trunk/stripes/src/net/sourceforge/stripes/util/HttpUtil.java        
2009-01-06 04:48:54 UTC (rev 1029)
@@ -61,6 +61,21 @@
             return servletPath + pathInfo;
     }
 
+    /**
+     * Get the servlet path of the current request. The value returned by this 
method may differ
+     * from {...@link HttpServletRequest#getServletPath()}. If the given 
request is an include, then
+     * the servlet path of the included resource is returned.
+     */
+    public static String getRequestedServletPath(HttpServletRequest request) {
+        // Check to see if the request is processing an include, and pull the 
path
+        // information from the appropriate source.
+        String path = (String) 
request.getAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH);
+        if (path == null) {
+            path = request.getServletPath();
+        }
+        return path == null ? "" : path;
+    }
+
     /** No instances */
     private HttpUtil() {
     }


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

------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to