[jboss-cvs] jboss-seam/src/main/org/jboss/seam/servlet ...
Gavin King
gavin.king at jboss.com
Sat Sep 30 15:57:14 EDT 2006
User: gavin
Date: 06/09/30 15:57:14
Modified: src/main/org/jboss/seam/servlet SeamRedirectFilter.java
Log:
make page params work for both kinds of servlet mappings
fix a default scoping issue of factory methods
Revision Changes Path
1.8 +16 -4 jboss-seam/src/main/org/jboss/seam/servlet/SeamRedirectFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamRedirectFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/servlet/SeamRedirectFilter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- SeamRedirectFilter.java 27 Sep 2006 23:14:42 -0000 1.7
+++ SeamRedirectFilter.java 30 Sep 2006 19:57:14 -0000 1.8
@@ -60,18 +60,23 @@
public static String getViewId(String url)
{
+ //for /seam/* style servlet mappings
+ String pathInfo = FacesContext.getCurrentInstance().getExternalContext().getRequestPathInfo();
String servletPath = FacesContext.getCurrentInstance().getExternalContext().getRequestServletPath();
String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
- String pathInfo = FacesContext.getCurrentInstance().getExternalContext().getRequestPathInfo();
+ if (pathInfo!=null)
+ {
+ return url.substring( contextPath.length() + servletPath.length(), getParamLoc(url) );
+ }
+
+ //for *.seam style servlet mappings
if ( url.startsWith(contextPath) )
{
String extension = servletPath.substring( servletPath.indexOf('.') );
if ( url.endsWith(extension) || url.contains(extension + '?') )
{
- int loc = url.indexOf('?');
- if (loc<0) loc = url.length();
String suffix = getSuffix();
- return url.substring(contextPath.length(), loc - suffix.length() + 1) + suffix;
+ return url.substring(contextPath.length(), getParamLoc(url) - suffix.length() + 1) + suffix;
}
else
{
@@ -84,6 +89,13 @@
}
}
+ private static int getParamLoc(String url)
+ {
+ int loc = url.indexOf('?');
+ if (loc<0) loc = url.length();
+ return loc;
+ }
+
public static String getSuffix()
{
String defaultSuffix = FacesContext.getCurrentInstance().getExternalContext()
More information about the jboss-cvs-commits
mailing list