From 8edb7a18ccb8cd1d1b072f1cf2931c9e7e932bfc Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 17 Jan 2014 20:07:30 +0100 Subject: [PATCH] Revert previous impl for SPR-10163 This reverts commit 96b418cc8ae537e985cfe67b80cd866d03c8060f, "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 --- .../AnnotationDrivenBeanDefinitionParser.java | 13 -------- .../web/servlet/config/spring-mvc-4.0.xsd | 29 ---------------- ...tationDrivenBeanDefinitionParserTests.java | 33 +++---------------- ...mvc-config-content-negotiation-manager.xml | 3 +- .../config/mvc-config-custom-attributes.xml | 13 -------- 5 files changed, 6 insertions(+), 85 deletions(-) delete mode 100644 spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-attributes.xml 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 917f3296155..7b4ceef94f0 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 @@ -171,19 +171,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { Boolean enableMatrixVariables = Boolean.valueOf(element.getAttribute("enableMatrixVariables")); handlerMappingDef.getPropertyValues().add("removeSemicolonContent", !enableMatrixVariables); } - if(element.hasAttribute("use-suffix-pattern-match")) { - handlerMappingDef.getPropertyValues().add("useSuffixPatternMatch", - Boolean.valueOf(element.getAttribute("use-suffix-pattern-match"))); - } - if(element.hasAttribute("use-trailing-slash-match")) { - handlerMappingDef.getPropertyValues().add("useTrailingSlashMatch", - Boolean.valueOf(element.getAttribute("use-trailing-slash-match"))); - } - if(element.hasAttribute("use-registered-suffix-pattern-match")) { - handlerMappingDef.getPropertyValues().add("useRegisteredSuffixPatternMatch", - Boolean.valueOf(element.getAttribute("use-registered-suffix-pattern-match"))); - } - RuntimeBeanReference conversionService = getConversionService(element, source, parserContext); RuntimeBeanReference validator = getValidator(element, source, parserContext); diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.0.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.0.xsd index 99319837bb1..985d54a5846 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.0.xsd +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.0.xsd @@ -255,35 +255,6 @@ ]]> - - - - - - - - - - - - - - - diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java index bb78a4d4771..3f72adf22e5 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,10 @@ */ package org.springframework.web.servlet.config; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.List; import org.junit.Before; @@ -38,16 +42,11 @@ import org.springframework.web.method.support.ModelAndViewContainer; import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.ServletWebArgumentResolverAdapter; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - /** * Test fixture for the configuration in mvc-config-annotation-driven.xml. * @author Rossen Stoyanchev - * @author Brian Clozel */ public class AnnotationDrivenBeanDefinitionParserTests { @@ -71,28 +70,6 @@ public class AnnotationDrivenBeanDefinitionParserTests { assertEquals(false, new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")); } - @Test - public void testCustomContentNegotiationManager() { - loadBeanDefinitions("mvc-config-content-negotiation-manager.xml"); - RequestMappingHandlerMapping hm = appContext.getBean(RequestMappingHandlerMapping.class); - assertNotNull(hm); - assertTrue(hm.useSuffixPatternMatch()); - assertTrue(hm.useRegisteredSuffixPatternMatch()); - List fileExtensions = hm.getContentNegotiationManager().getAllFileExtensions(); - assertThat(fileExtensions, contains("xml")); - assertThat(fileExtensions, hasSize(1)); - } - - @Test - public void testRequestMappingCustomAttributes() { - loadBeanDefinitions("mvc-config-custom-attributes.xml"); - RequestMappingHandlerMapping hm = appContext.getBean(RequestMappingHandlerMapping.class); - assertNotNull(hm); - assertFalse(hm.getUrlPathHelper().shouldRemoveSemicolonContent()); - assertFalse(hm.useTrailingSlashMatch()); - assertFalse(hm.useSuffixPatternMatch()); - } - @Test public void testMessageConverters() { loadBeanDefinitions("mvc-config-message-converters.xml"); diff --git a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-content-negotiation-manager.xml b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-content-negotiation-manager.xml index 2f7a1a858a4..76fa6539570 100644 --- a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-content-negotiation-manager.xml +++ b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-content-negotiation-manager.xml @@ -5,8 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-attributes.xml b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-attributes.xml deleted file mode 100644 index 07c64a54b06..00000000000 --- a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-attributes.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - -