diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java index 49ba49a4e42..9a18935981a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java @@ -157,6 +157,10 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { handlerMappingDef.getPropertyValues().add("order", 0); handlerMappingDef.getPropertyValues().add("contentNegotiationManager", contentNegotiationManager); String methodMappingName = parserContext.getReaderContext().registerWithGeneratedName(handlerMappingDef); + if (element.hasAttribute("enableMatrixVariables")) { + Boolean enableMatrixVariables = Boolean.valueOf(element.getAttribute("enableMatrixVariables")); + handlerMappingDef.getPropertyValues().add("removeSemicolonContent", !enableMatrixVariables); + } RuntimeBeanReference conversionService = getConversionService(element, source, parserContext); RuntimeBeanReference validator = getValidator(element, source, parserContext); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java index 9d121fc11a5..7efaf91ab20 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java @@ -128,7 +128,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport /** * Set if ";" (semicolon) content should be stripped from the request URI. - *

The default value is {@code false}. + *

The default value is {@code true}. * @see org.springframework.web.util.UrlPathHelper#setRemoveSemicolonContent(boolean) */ public void setRemoveSemicolonContent(boolean removeSemicolonContent) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java index deca4899059..27958ebbcad 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java @@ -25,6 +25,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -37,7 +38,6 @@ import org.springframework.util.ReflectionUtils.MethodFilter; import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethodSelector; import org.springframework.web.servlet.HandlerMapping; -import org.springframework.web.util.UrlPathHelper; /** * Abstract base class for {@link HandlerMapping} implementations that define a @@ -62,12 +62,6 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap private final MultiValueMap urlMap = new LinkedMultiValueMap(); - public AbstractHandlerMethodMapping() { - UrlPathHelper pathHelper = new UrlPathHelper(); - pathHelper.setRemoveSemicolonContent(false); - setUrlPathHelper(pathHelper); - } - /** * Whether to detect handler methods in beans in ancestor ApplicationContexts. *

Default is "false": Only beans in the current ApplicationContext are diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java index 3e657e02b90..b523bba2541 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java @@ -42,13 +42,6 @@ import org.springframework.web.util.UrlPathHelper; */ public final class PatternsRequestCondition extends AbstractRequestCondition { - private static UrlPathHelper pathHelperNoSemicolonContent; - - static { - pathHelperNoSemicolonContent = new UrlPathHelper(); - pathHelperNoSemicolonContent.setRemoveSemicolonContent(true); - } - private final Set patterns; private final UrlPathHelper pathHelper; @@ -217,15 +210,10 @@ public final class PatternsRequestCondition extends AbstractRequestCondition matches = new ArrayList(); for (String pattern : patterns) { String match = getMatchingPattern(pattern, lookupPath); - if (match == null && lookupPathNoSemicolonContent != null) { - match = getMatchingPattern(pattern, lookupPathNoSemicolonContent); - } if (match != null) { matches.add(match); } diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.2.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.2.xsd index 627d289ccd2..2537aa15fca 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.2.xsd +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.2.xsd @@ -231,6 +231,17 @@ + + + + + + + + + + + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> - + diff --git a/src/reference/docbook/mvc.xml b/src/reference/docbook/mvc.xml index a9e8489af34..1b8a2e0c283 100644 --- a/src/reference/docbook/mvc.xml +++ b/src/reference/docbook/mvc.xml @@ -1173,9 +1173,7 @@ public void findPet( Note that to enable the use of matrix variables, you must set the removeSemicolonContent property of RequestMappingHandlerMapping to false. - By default it is set to true with the exception of the - MVC namespace and the MVC Java config both of which automatically enable - the use of matrix variables. + By default it is set to false.