Author: norman.richards(a)jboss.com
Date: 2008-09-17 20:17:47 -0400 (Wed, 17 Sep 2008)
New Revision: 9010
Modified:
trunk/src/main/org/jboss/seam/contexts/FacesLifecycle.java
trunk/src/main/org/jboss/seam/mock/MockExternalContext.java
Log:
JBSEAM-2921
Modified: trunk/src/main/org/jboss/seam/contexts/FacesLifecycle.java
===================================================================
--- trunk/src/main/org/jboss/seam/contexts/FacesLifecycle.java 2008-09-17 23:30:31 UTC
(rev 9009)
+++ trunk/src/main/org/jboss/seam/contexts/FacesLifecycle.java 2008-09-18 00:17:47 UTC
(rev 9010)
@@ -6,9 +6,12 @@
*/
package org.jboss.seam.contexts;
+import java.util.Map;
+
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
+import javax.servlet.ServletRequest;
import org.jboss.seam.ScopeType;
import org.jboss.seam.log.LogProvider;
@@ -58,7 +61,22 @@
}
Contexts.conversationContext.set(null); //in case endRequest() was never called
//Events.instance(); //TODO: only for now, until we have a way to do EL outside of
JSF!
+
+ saveRequestPath(externalContext);
}
+
+
+ /**
+ * with rewriting, the filter chain might not have access to the post-rewrite request
information.
+ * we'll save some of the information that we may need.
+ */
+ private static void saveRequestPath(ExternalContext externalContext) {
+ Map<String, Object> map = externalContext.getRequestMap();
+
+ map.put("org.jboss.seam.web.requestServletPath",
externalContext.getRequestServletPath());
+ map.put("org.jboss.seam.web.requestContextPath",
externalContext.getRequestContextPath());
+ map.put("org.jboss.seam.web.requestPathInfo",
externalContext.getRequestPathInfo());
+ }
public static void beginExceptionRecovery(ExternalContext externalContext)
{
Modified: trunk/src/main/org/jboss/seam/mock/MockExternalContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/MockExternalContext.java 2008-09-17 23:30:31 UTC
(rev 9009)
+++ trunk/src/main/org/jboss/seam/mock/MockExternalContext.java 2008-09-18 00:17:47 UTC
(rev 9010)
@@ -182,7 +182,8 @@
@Override
public String getRequestContextPath()
{
- return request.getContextPath();
+ String path = (String)
request.getAttribute("org.jboss.seam.web.requestContextPath");
+ return path!=null ? path : request.getContextPath();
}
@Override
@@ -304,13 +305,15 @@
@Override
public String getRequestPathInfo()
{
- return request.getPathInfo();
+ String path = (String)
request.getAttribute("org.jboss.seam.web.requestPathInfo");
+ return path!=null ? path : request.getPathInfo();
}
@Override
public String getRequestServletPath()
{
- return request.getServletPath();
+ String path = (String)
request.getAttribute("org.jboss.seam.web.requestServletPath");
+ return path!=null ? path : request.getPathInfo();
}
@Override