myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r608433 - /myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
Date Thu, 03 Jan 2008 10:46:09 GMT
Author: imario
Date: Thu Jan  3 02:46:08 2008
New Revision: 608433

URL: http://svn.apache.org/viewvc?rev=608433&view=rev
Log:
MYFACES-1798: fixed detection of extension mapping

Modified:
    myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java

Modified: myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java?rev=608433&r1=608432&r2=608433&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
(original)
+++ myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
Thu Jan  3 02:46:08 2008
@@ -43,12 +43,6 @@
 	private static final String CACHED_SERVLET_MAPPING =
 		DefaultViewHandlerSupport.class.getName() + ".CACHED_SERVLET_MAPPING";
 
-	/**
-	 * A RegEx pattern to determine if an extension is available in the given
-	 * path.
-	 */
-	private static final Pattern EXTENSION_PATTERN = Pattern.compile("(\\..*)");
-
 	private static final Log log = LogFactory.getLog(DefaultViewHandlerSupport.class);
 
 	public String calculateViewId(FacesContext context, String viewId)
@@ -161,10 +155,10 @@
 			// Actually, if there was an exact match no "extra path"
 			// is available (e.g. if the url-pattern is "/faces/*"
 			// and the request-uri is "/context/faces").
-			Matcher extensionMatcher = EXTENSION_PATTERN.matcher(servletPath);
-			if (extensionMatcher.find())
+			int extensionPos = servletPath.lastIndexOf('.');
+			if (extensionPos > -1)
 			{
-				String extension = extensionMatcher.group(1);
+				String extension = servletPath.substring(extensionPos);
 				return FacesServletMapping.createExtensionMapping(extension);
 			}
 			else



Mime
View raw message