Skip to content

Commit 8edb7a1

Browse files
committed
Revert previous impl for SPR-10163
This reverts commit 96b418c, "Make RequestMappingHandlerMapping xml config easier". This implementation makes the mvc:annotation namespace less readable, and future configuration items would add even more to this namespace. Issue: SPR-10163
1 parent 17e492e commit 8edb7a1

File tree

5 files changed

+6
-85
lines changed

5 files changed

+6
-85
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,6 @@ else if (element.hasAttribute("enableMatrixVariables")) {
171171
Boolean enableMatrixVariables = Boolean.valueOf(element.getAttribute("enableMatrixVariables"));
172172
handlerMappingDef.getPropertyValues().add("removeSemicolonContent", !enableMatrixVariables);
173173
}
174-
if(element.hasAttribute("use-suffix-pattern-match")) {
175-
handlerMappingDef.getPropertyValues().add("useSuffixPatternMatch",
176-
Boolean.valueOf(element.getAttribute("use-suffix-pattern-match")));
177-
}
178-
if(element.hasAttribute("use-trailing-slash-match")) {
179-
handlerMappingDef.getPropertyValues().add("useTrailingSlashMatch",
180-
Boolean.valueOf(element.getAttribute("use-trailing-slash-match")));
181-
}
182-
if(element.hasAttribute("use-registered-suffix-pattern-match")) {
183-
handlerMappingDef.getPropertyValues().add("useRegisteredSuffixPatternMatch",
184-
Boolean.valueOf(element.getAttribute("use-registered-suffix-pattern-match")));
185-
}
186-
187174

188175
RuntimeBeanReference conversionService = getConversionService(element, source, parserContext);
189176
RuntimeBeanReference validator = getValidator(element, source, parserContext);

spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.0.xsd

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -255,35 +255,6 @@
255255
]]></xsd:documentation>
256256
</xsd:annotation>
257257
</xsd:attribute>
258-
<xsd:attribute name="use-suffix-pattern-match" type="xsd:boolean">
259-
<xsd:annotation>
260-
<xsd:documentation><![CDATA[
261-
Whether to use suffix pattern match (".*") when matching patterns to requests. If enabled
262-
a method mapped to "/users" also matches to "/users.*". The default value is true.
263-
]]></xsd:documentation>
264-
</xsd:annotation>
265-
</xsd:attribute>
266-
<xsd:attribute name="use-trailing-slash-match" type="xsd:boolean">
267-
<xsd:annotation>
268-
<xsd:documentation><![CDATA[
269-
Whether to match to URLs irrespective of the presence of a trailing slash.
270-
If enabled a method mapped to "/users" also matches to "/users/".
271-
The default value is true.
272-
]]></xsd:documentation>
273-
</xsd:annotation>
274-
</xsd:attribute>
275-
<xsd:attribute name="use-registered-suffix-pattern-match" type="xsd:boolean">
276-
<xsd:annotation>
277-
<xsd:documentation><![CDATA[
278-
Whether to use suffix pattern match for registered file extensions only when matching patterns to requests.
279-
If enabled, a controller method mapped to "/users" also matches to "/users.json" assuming ".json" is a file extension registered with
280-
the provided ContentNegotiationManager. This can be useful for allowing only specific URL extensions to be used as well as in cases
281-
where a "." in the URL path can lead to ambiguous interpretation of path variable content, (e.g. given "/users/{user}" and incoming
282-
URLs such as "/users/john.j.joe" and "/users/john.j.joe.json").
283-
If enabled, this attribute also enables use-suffix-pattern-match. The default value is false.
284-
]]></xsd:documentation>
285-
</xsd:annotation>
286-
</xsd:attribute>
287258
</xsd:complexType>
288259
</xsd:element>
289260

spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,10 @@
1515
*/
1616
package org.springframework.web.servlet.config;
1717

18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertNotNull;
20+
import static org.junit.Assert.assertTrue;
21+
1822
import java.util.List;
1923

2024
import org.junit.Before;
@@ -38,16 +42,11 @@
3842
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
3943
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
4044
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
41-
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
4245
import org.springframework.web.servlet.mvc.method.annotation.ServletWebArgumentResolverAdapter;
4346

44-
import static org.hamcrest.Matchers.*;
45-
import static org.junit.Assert.*;
46-
4747
/**
4848
* Test fixture for the configuration in mvc-config-annotation-driven.xml.
4949
* @author Rossen Stoyanchev
50-
* @author Brian Clozel
5150
*/
5251
public class AnnotationDrivenBeanDefinitionParserTests {
5352

@@ -71,28 +70,6 @@ public void testMessageCodesResolver() {
7170
assertEquals(false, new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect"));
7271
}
7372

74-
@Test
75-
public void testCustomContentNegotiationManager() {
76-
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml");
77-
RequestMappingHandlerMapping hm = appContext.getBean(RequestMappingHandlerMapping.class);
78-
assertNotNull(hm);
79-
assertTrue(hm.useSuffixPatternMatch());
80-
assertTrue(hm.useRegisteredSuffixPatternMatch());
81-
List<String> fileExtensions = hm.getContentNegotiationManager().getAllFileExtensions();
82-
assertThat(fileExtensions, contains("xml"));
83-
assertThat(fileExtensions, hasSize(1));
84-
}
85-
86-
@Test
87-
public void testRequestMappingCustomAttributes() {
88-
loadBeanDefinitions("mvc-config-custom-attributes.xml");
89-
RequestMappingHandlerMapping hm = appContext.getBean(RequestMappingHandlerMapping.class);
90-
assertNotNull(hm);
91-
assertFalse(hm.getUrlPathHelper().shouldRemoveSemicolonContent());
92-
assertFalse(hm.useTrailingSlashMatch());
93-
assertFalse(hm.useSuffixPatternMatch());
94-
}
95-
9673
@Test
9774
public void testMessageConverters() {
9875
loadBeanDefinitions("mvc-config-message-converters.xml");

spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-content-negotiation-manager.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
66
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
77

8-
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"
9-
use-registered-suffix-pattern-match="true"/>
8+
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
109

1110
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
1211
<property name="mediaTypes">

spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-attributes.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)