Rename RequestMapping types for concision
Remove 'Method' from RequestMappingHandlerMethodMapping and RequestMappingHandlerMethodAdapter
This commit is contained in:
parent
2092a31f9d
commit
1efb82d7cb
|
|
@ -49,8 +49,8 @@ import org.springframework.web.servlet.handler.ConversionServiceExposingIntercep
|
||||||
import org.springframework.web.servlet.handler.MappedInterceptor;
|
import org.springframework.web.servlet.handler.MappedInterceptor;
|
||||||
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodMapping;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.support.ServletWebArgumentResolverAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.support.ServletWebArgumentResolverAdapter;
|
||||||
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
@ -105,7 +105,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
|
CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
|
||||||
parserContext.pushContainingComponent(compDefinition);
|
parserContext.pushContainingComponent(compDefinition);
|
||||||
|
|
||||||
RootBeanDefinition methodMappingDef = new RootBeanDefinition(RequestMappingHandlerMethodMapping.class);
|
RootBeanDefinition methodMappingDef = new RootBeanDefinition(RequestMappingHandlerMapping.class);
|
||||||
methodMappingDef.setSource(source);
|
methodMappingDef.setSource(source);
|
||||||
methodMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
methodMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
methodMappingDef.getPropertyValues().add("order", 0);
|
methodMappingDef.getPropertyValues().add("order", 0);
|
||||||
|
|
@ -125,7 +125,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
ManagedList<?> messageConverters = getMessageConverters(element, source, parserContext);
|
ManagedList<?> messageConverters = getMessageConverters(element, source, parserContext);
|
||||||
ManagedList<?> argumentResolvers = getArgumentResolvers(element, source, parserContext);
|
ManagedList<?> argumentResolvers = getArgumentResolvers(element, source, parserContext);
|
||||||
|
|
||||||
RootBeanDefinition methodAdapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition methodAdapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
methodAdapterDef.setSource(source);
|
methodAdapterDef.setSource(source);
|
||||||
methodAdapterDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
methodAdapterDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
methodAdapterDef.getPropertyValues().add("webBindingInitializer", bindingDef);
|
methodAdapterDef.getPropertyValues().add("webBindingInitializer", bindingDef);
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
|
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodMapping;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,7 +79,7 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
|
||||||
*
|
*
|
||||||
* <p>Registers these handler mappings:
|
* <p>Registers these handler mappings:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link RequestMappingHandlerMethodMapping} ordered at 0 for mapping requests to annotated controller methods.
|
* <li>{@link RequestMappingHandlerMapping} ordered at 0 for mapping requests to annotated controller methods.
|
||||||
* <li>{@link SimpleUrlHandlerMapping} ordered at 1 to map URL paths directly to view names.
|
* <li>{@link SimpleUrlHandlerMapping} ordered at 1 to map URL paths directly to view names.
|
||||||
* <li>{@link BeanNameUrlHandlerMapping} ordered at 2 to map URL paths to controller bean names.
|
* <li>{@link BeanNameUrlHandlerMapping} ordered at 2 to map URL paths to controller bean names.
|
||||||
* <li>{@link SimpleUrlHandlerMapping} ordered at {@code Integer.MAX_VALUE-1} to serve static resource requests.
|
* <li>{@link SimpleUrlHandlerMapping} ordered at {@code Integer.MAX_VALUE-1} to serve static resource requests.
|
||||||
|
|
@ -91,7 +91,7 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
|
||||||
*
|
*
|
||||||
* <p>Registers these handler adapters:
|
* <p>Registers these handler adapters:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link RequestMappingHandlerMethodAdapter} for processing requests using annotated controller methods.
|
* <li>{@link RequestMappingHandlerAdapter} for processing requests using annotated controller methods.
|
||||||
* <li>{@link HttpRequestHandlerAdapter} for processing requests with {@link HttpRequestHandler}s.
|
* <li>{@link HttpRequestHandlerAdapter} for processing requests with {@link HttpRequestHandler}s.
|
||||||
* <li>{@link SimpleControllerHandlerAdapter} for processing requests with interface-based {@link Controller}s.
|
* <li>{@link SimpleControllerHandlerAdapter} for processing requests with interface-based {@link Controller}s.
|
||||||
* </ul>
|
* </ul>
|
||||||
|
|
@ -139,8 +139,8 @@ class MvcConfiguration implements ApplicationContextAware, ServletContextAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
RequestMappingHandlerMethodMapping requestMappingHandlerMapping() {
|
RequestMappingHandlerMapping requestMappingHandlerMapping() {
|
||||||
RequestMappingHandlerMethodMapping mapping = new RequestMappingHandlerMethodMapping();
|
RequestMappingHandlerMapping mapping = new RequestMappingHandlerMapping();
|
||||||
mapping.setOrder(0);
|
mapping.setOrder(0);
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
@ -176,8 +176,8 @@ class MvcConfiguration implements ApplicationContextAware, ServletContextAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
RequestMappingHandlerMethodAdapter requestMappingHandlerAdapter() {
|
RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
|
||||||
RequestMappingHandlerMethodAdapter adapter = new RequestMappingHandlerMethodAdapter();
|
RequestMappingHandlerAdapter adapter = new RequestMappingHandlerAdapter();
|
||||||
|
|
||||||
ConfigurableWebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
|
ConfigurableWebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
|
||||||
bindingInitializer.setConversionService(conversionService());
|
bindingInitializer.setConversionService(conversionService());
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ import org.springframework.web.servlet.mvc.method.annotation.support.ViewMethodR
|
||||||
* {@link ExceptionMethodMapping} assists with actually locating a method for a thrown exception.
|
* {@link ExceptionMethodMapping} assists with actually locating a method for a thrown exception.
|
||||||
*
|
*
|
||||||
* <p>Once located the invocation of the exception-handling method is done using much of the same classes
|
* <p>Once located the invocation of the exception-handling method is done using much of the same classes
|
||||||
* used for {@link RequestMapping} methods, which is described under {@link RequestMappingHandlerMethodAdapter}.
|
* used for {@link RequestMapping} methods, which is described under {@link RequestMappingHandlerAdapter}.
|
||||||
*
|
*
|
||||||
* <p>See {@link ExceptionHandler} for information on supported method arguments and return values for
|
* <p>See {@link ExceptionHandler} for information on supported method arguments and return values for
|
||||||
* exception-handling methods.
|
* exception-handling methods.
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ import org.springframework.web.util.WebUtils;
|
||||||
* @see HandlerMethodArgumentResolver
|
* @see HandlerMethodArgumentResolver
|
||||||
* @see HandlerMethodReturnValueHandler
|
* @see HandlerMethodReturnValueHandler
|
||||||
*/
|
*/
|
||||||
public class RequestMappingHandlerMethodAdapter extends AbstractHandlerMethodAdapter implements BeanFactoryAware,
|
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter implements BeanFactoryAware,
|
||||||
InitializingBean {
|
InitializingBean {
|
||||||
|
|
||||||
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
|
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
|
||||||
|
|
@ -155,9 +155,9 @@ public class RequestMappingHandlerMethodAdapter extends AbstractHandlerMethodAda
|
||||||
private HandlerMethodArgumentResolverComposite initBinderArgumentResolvers;
|
private HandlerMethodArgumentResolverComposite initBinderArgumentResolvers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link RequestMappingHandlerMethodAdapter} instance.
|
* Create a {@link RequestMappingHandlerAdapter} instance.
|
||||||
*/
|
*/
|
||||||
public RequestMappingHandlerMethodAdapter() {
|
public RequestMappingHandlerAdapter() {
|
||||||
|
|
||||||
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
||||||
stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316
|
stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316
|
||||||
|
|
@ -51,9 +51,9 @@ import org.springframework.web.servlet.mvc.method.condition.RequestConditionFact
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 3.1.0
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
public class RequestMappingHandlerMethodMapping extends AbstractHandlerMethodMapping<RequestMappingInfo> {
|
public class RequestMappingHandlerMapping extends AbstractHandlerMethodMapping<RequestMappingInfo> {
|
||||||
|
|
||||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
private PathMatcher pathMatcher = new AntPathMatcher();
|
||||||
|
|
||||||
|
|
@ -214,7 +214,7 @@ public class RequestMappingHandlerMethodMapping extends AbstractHandlerMethodMap
|
||||||
* <ul><li>Each RequestMappingInfo has been fully matched to the request <li>The RequestMappingInfo contains
|
* <ul><li>Each RequestMappingInfo has been fully matched to the request <li>The RequestMappingInfo contains
|
||||||
* matched patterns only <li>Patterns are ordered with the best matching pattern at the top </ul>
|
* matched patterns only <li>Patterns are ordered with the best matching pattern at the top </ul>
|
||||||
*
|
*
|
||||||
* @see RequestMappingHandlerMethodMapping#getMatchingMapping(RequestMappingInfo, String, HttpServletRequest)
|
* @see RequestMappingHandlerMapping#getMatchingMapping(RequestMappingInfo, String, HttpServletRequest)
|
||||||
*/
|
*/
|
||||||
private class RequestMappingInfoComparator implements Comparator<RequestMappingInfo> {
|
private class RequestMappingInfoComparator implements Comparator<RequestMappingInfo> {
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter;
|
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.ExceptionHandlerExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.support.ServletWebArgumentResolverAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.support.ServletWebArgumentResolverAdapter;
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class AnnotationDrivenBeanDefinitionParserTests {
|
||||||
@Test
|
@Test
|
||||||
public void testMessageCodesResolver() {
|
public void testMessageCodesResolver() {
|
||||||
loadBeanDefinitions("mvc-config-message-codes-resolver.xml");
|
loadBeanDefinitions("mvc-config-message-codes-resolver.xml");
|
||||||
RequestMappingHandlerMethodAdapter adapter = appContext.getBean(RequestMappingHandlerMethodAdapter.class);
|
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
|
||||||
assertNotNull(adapter);
|
assertNotNull(adapter);
|
||||||
Object initializer = new DirectFieldAccessor(adapter).getPropertyValue("webBindingInitializer");
|
Object initializer = new DirectFieldAccessor(adapter).getPropertyValue("webBindingInitializer");
|
||||||
assertNotNull(initializer);
|
assertNotNull(initializer);
|
||||||
|
|
@ -70,14 +70,14 @@ public class AnnotationDrivenBeanDefinitionParserTests {
|
||||||
@Test
|
@Test
|
||||||
public void testMessageConverters() {
|
public void testMessageConverters() {
|
||||||
loadBeanDefinitions("mvc-config-message-converters.xml");
|
loadBeanDefinitions("mvc-config-message-converters.xml");
|
||||||
verifyMessageConverters(appContext.getBean(RequestMappingHandlerMethodAdapter.class), true);
|
verifyMessageConverters(appContext.getBean(RequestMappingHandlerAdapter.class), true);
|
||||||
verifyMessageConverters(appContext.getBean(ExceptionHandlerExceptionResolver.class), true);
|
verifyMessageConverters(appContext.getBean(ExceptionHandlerExceptionResolver.class), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMessageConvertersWithoutDefaultRegistrations() {
|
public void testMessageConvertersWithoutDefaultRegistrations() {
|
||||||
loadBeanDefinitions("mvc-config-message-converters-defaults-off.xml");
|
loadBeanDefinitions("mvc-config-message-converters-defaults-off.xml");
|
||||||
verifyMessageConverters(appContext.getBean(RequestMappingHandlerMethodAdapter.class), false);
|
verifyMessageConverters(appContext.getBean(RequestMappingHandlerAdapter.class), false);
|
||||||
verifyMessageConverters(appContext.getBean(ExceptionHandlerExceptionResolver.class), false);
|
verifyMessageConverters(appContext.getBean(ExceptionHandlerExceptionResolver.class), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ public class AnnotationDrivenBeanDefinitionParserTests {
|
||||||
@Test
|
@Test
|
||||||
public void testArgumentResolvers() {
|
public void testArgumentResolvers() {
|
||||||
loadBeanDefinitions("mvc-config-argument-resolvers.xml");
|
loadBeanDefinitions("mvc-config-argument-resolvers.xml");
|
||||||
RequestMappingHandlerMethodAdapter adapter = appContext.getBean(RequestMappingHandlerMethodAdapter.class);
|
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
|
||||||
assertNotNull(adapter);
|
assertNotNull(adapter);
|
||||||
Object value = new DirectFieldAccessor(adapter).getPropertyValue("customArgumentResolvers");
|
Object value = new DirectFieldAccessor(adapter).getPropertyValue("customArgumentResolvers");
|
||||||
assertNotNull(value);
|
assertNotNull(value);
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,8 @@ import org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapt
|
||||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||||
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
|
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
|
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodMapping;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
import org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler;
|
import org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler;
|
||||||
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
|
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
|
||||||
import org.springframework.web.servlet.theme.ThemeChangeInterceptor;
|
import org.springframework.web.servlet.theme.ThemeChangeInterceptor;
|
||||||
|
|
@ -104,12 +104,12 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(8, appContext.getBeanDefinitionCount());
|
assertEquals(8, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = appContext.getBean(RequestMappingHandlerMethodMapping.class);
|
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||||
assertNotNull(mapping);
|
assertNotNull(mapping);
|
||||||
assertEquals(0, mapping.getOrder());
|
assertEquals(0, mapping.getOrder());
|
||||||
mapping.setDefaultHandler(handlerMethod);
|
mapping.setDefaultHandler(handlerMethod);
|
||||||
|
|
||||||
RequestMappingHandlerMethodAdapter adapter = appContext.getBean(RequestMappingHandlerMethodAdapter.class);
|
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
|
||||||
assertNotNull(adapter);
|
assertNotNull(adapter);
|
||||||
|
|
||||||
List<HttpMessageConverter<?>> messageConverters = adapter.getMessageConverters();
|
List<HttpMessageConverter<?>> messageConverters = adapter.getMessageConverters();
|
||||||
|
|
@ -143,7 +143,7 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(8, appContext.getBeanDefinitionCount());
|
assertEquals(8, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = appContext.getBean(RequestMappingHandlerMethodMapping.class);
|
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||||
assertNotNull(mapping);
|
assertNotNull(mapping);
|
||||||
mapping.setDefaultHandler(handlerMethod);
|
mapping.setDefaultHandler(handlerMethod);
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ public class MvcNamespaceTests {
|
||||||
interceptor.preHandle(request, response, handler);
|
interceptor.preHandle(request, response, handler);
|
||||||
assertSame(appContext.getBean("conversionService"), request.getAttribute(ConversionService.class.getName()));
|
assertSame(appContext.getBean("conversionService"), request.getAttribute(ConversionService.class.getName()));
|
||||||
|
|
||||||
RequestMappingHandlerMethodAdapter adapter = appContext.getBean(RequestMappingHandlerMethodAdapter.class);
|
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
|
||||||
assertNotNull(adapter);
|
assertNotNull(adapter);
|
||||||
adapter.handle(request, response, handlerMethod);
|
adapter.handle(request, response, handlerMethod);
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(8, appContext.getBeanDefinitionCount());
|
assertEquals(8, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodAdapter adapter = appContext.getBean(RequestMappingHandlerMethodAdapter.class);
|
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
|
||||||
assertNotNull(adapter);
|
assertNotNull(adapter);
|
||||||
|
|
||||||
// default web binding initializer behavior test
|
// default web binding initializer behavior test
|
||||||
|
|
@ -192,7 +192,7 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(11, appContext.getBeanDefinitionCount());
|
assertEquals(11, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = appContext.getBean(RequestMappingHandlerMethodMapping.class);
|
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||||
assertNotNull(mapping);
|
assertNotNull(mapping);
|
||||||
mapping.setDefaultHandler(handlerMethod);
|
mapping.setDefaultHandler(handlerMethod);
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(10, appContext.getBeanDefinitionCount());
|
assertEquals(10, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = appContext.getBean(RequestMappingHandlerMethodMapping.class);
|
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||||
assertNotNull(mapping);
|
assertNotNull(mapping);
|
||||||
mapping.setDefaultHandler(handlerMethod);
|
mapping.setDefaultHandler(handlerMethod);
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ public class MvcNamespaceTests {
|
||||||
assertEquals(12, appContext.getBeanDefinitionCount());
|
assertEquals(12, appContext.getBeanDefinitionCount());
|
||||||
appContext.refresh();
|
appContext.refresh();
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = appContext.getBean(RequestMappingHandlerMethodMapping.class);
|
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
|
||||||
assertNotNull(mapping);
|
assertNotNull(mapping);
|
||||||
mapping.setDefaultHandler(handlerMethod);
|
mapping.setDefaultHandler(handlerMethod);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMethodAdapter;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
|
||||||
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,7 +75,7 @@ public class MvcConfigurationTests {
|
||||||
configurer.configureMessageConverters(capture(converters));
|
configurer.configureMessageConverters(capture(converters));
|
||||||
replay(configurer);
|
replay(configurer);
|
||||||
|
|
||||||
RequestMappingHandlerMethodAdapter adapter = mvcConfiguration.requestMappingHandlerAdapter();
|
RequestMappingHandlerAdapter adapter = mvcConfiguration.requestMappingHandlerAdapter();
|
||||||
|
|
||||||
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
|
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
|
||||||
assertSame(conversionService.getValue(), initializer.getConversionService());
|
assertSame(conversionService.getValue(), initializer.getConversionService());
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ public class HandlerMethodMappingAnnotationDetectionTests {
|
||||||
public void detectAndMapHandlerMethod() throws Exception {
|
public void detectAndMapHandlerMethod() throws Exception {
|
||||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/type/handle");
|
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/type/handle");
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = createHandlerMapping(handler.getClass(), useAutoProxy);
|
RequestMappingHandlerMapping mapping = createHandlerMapping(handler.getClass(), useAutoProxy);
|
||||||
HandlerMethod handlerMethod = (HandlerMethod) mapping.getHandler(request).getHandler();
|
HandlerMethod handlerMethod = (HandlerMethod) mapping.getHandler(request).getHandler();
|
||||||
|
|
||||||
assertNotNull("Failed to detect and map @RequestMapping handler method", handlerMethod);
|
assertNotNull("Failed to detect and map @RequestMapping handler method", handlerMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequestMappingHandlerMethodMapping createHandlerMapping(Class<?> controllerType, boolean useAutoProxy) {
|
private RequestMappingHandlerMapping createHandlerMapping(Class<?> controllerType, boolean useAutoProxy) {
|
||||||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerType));
|
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerType));
|
||||||
if (useAutoProxy) {
|
if (useAutoProxy) {
|
||||||
|
|
@ -96,7 +96,7 @@ public class HandlerMethodMappingAnnotationDetectionTests {
|
||||||
wac.getBeanFactory().registerSingleton("advsr", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
|
wac.getBeanFactory().registerSingleton("advsr", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestMappingHandlerMethodMapping mapping = new RequestMappingHandlerMethodMapping();
|
RequestMappingHandlerMapping mapping = new RequestMappingHandlerMapping();
|
||||||
mapping.setApplicationContext(wac);
|
mapping.setApplicationContext(wac);
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,20 @@ import static java.util.Arrays.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test fixture with {@link RequestMappingHandlerMethodMapping} testing its {@link RequestMappingInfo} comparator.
|
* Test fixture with {@link RequestMappingHandlerMapping} testing its {@link RequestMappingInfo} comparator.
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
*/
|
*/
|
||||||
public class RequestKeyComparatorTests {
|
public class RequestKeyComparatorTests {
|
||||||
|
|
||||||
private RequestMappingHandlerMethodMapping handlerMapping;
|
private RequestMappingHandlerMapping handlerMapping;
|
||||||
|
|
||||||
private MockHttpServletRequest request;
|
private MockHttpServletRequest request;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
this.handlerMapping = new RequestMappingHandlerMethodMapping();
|
this.handlerMapping = new RequestMappingHandlerMapping();
|
||||||
this.request = new MockHttpServletRequest();
|
this.request = new MockHttpServletRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,11 @@ import org.springframework.web.servlet.mvc.method.annotation.support.ServletWebA
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
*/
|
*/
|
||||||
public class RequestMappingHandlerMethodAdapterIntegrationTests {
|
public class RequestMappingHandlerAdapterIntegrationTests {
|
||||||
|
|
||||||
private final Object handler = new Handler();
|
private final Object handler = new Handler();
|
||||||
|
|
||||||
private RequestMappingHandlerMethodAdapter handlerAdapter;
|
private RequestMappingHandlerAdapter handlerAdapter;
|
||||||
|
|
||||||
private MockHttpServletRequest request;
|
private MockHttpServletRequest request;
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class RequestMappingHandlerMethodAdapterIntegrationTests {
|
||||||
GenericWebApplicationContext context = new GenericWebApplicationContext();
|
GenericWebApplicationContext context = new GenericWebApplicationContext();
|
||||||
context.refresh();
|
context.refresh();
|
||||||
|
|
||||||
handlerAdapter = new RequestMappingHandlerMethodAdapter();
|
handlerAdapter = new RequestMappingHandlerAdapter();
|
||||||
handlerAdapter.setWebBindingInitializer(bindingInitializer);
|
handlerAdapter.setWebBindingInitializer(bindingInitializer);
|
||||||
handlerAdapter.setCustomArgumentResolvers(customResolvers);
|
handlerAdapter.setCustomArgumentResolvers(customResolvers);
|
||||||
handlerAdapter.setApplicationContext(context);
|
handlerAdapter.setApplicationContext(context);
|
||||||
|
|
@ -161,7 +161,7 @@ public class RequestMappingHandlerMethodAdapterIntegrationTests {
|
||||||
|
|
||||||
System.setProperty("systemHeader", "systemHeaderValue");
|
System.setProperty("systemHeader", "systemHeaderValue");
|
||||||
|
|
||||||
/* Set up path variables as RequestMappingHandlerMethodMapping would... */
|
/* Set up path variables as RequestMappingHandlerMapping would... */
|
||||||
Map<String, String> uriTemplateVars = new HashMap<String, String>();
|
Map<String, String> uriTemplateVars = new HashMap<String, String>();
|
||||||
uriTemplateVars.put("pathvar", "pathvarValue");
|
uriTemplateVars.put("pathvar", "pathvarValue");
|
||||||
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
|
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
|
||||||
|
|
@ -31,20 +31,20 @@ import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.method.support.InvocableHandlerMethod;
|
import org.springframework.web.method.support.InvocableHandlerMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fine-grained {@link RequestMappingHandlerMethodAdapter} unit tests.
|
* Fine-grained {@link RequestMappingHandlerAdapter} unit tests.
|
||||||
*
|
*
|
||||||
* <p>For higher-level adapter tests see:
|
* <p>For higher-level adapter tests see:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link ServletHandlerMethodTests}
|
* <li>{@link ServletHandlerMethodTests}
|
||||||
* <li>{@link RequestMappingHandlerMethodAdapterIntegrationTests}
|
* <li>{@link RequestMappingHandlerAdapterIntegrationTests}
|
||||||
* <li>{@link HandlerMethodAdapterAnnotationDetectionTests}
|
* <li>{@link HandlerMethodAdapterAnnotationDetectionTests}
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
*/
|
*/
|
||||||
public class RequestMappingHandlerMethodAdapterTests {
|
public class RequestMappingHandlerAdapterTests {
|
||||||
|
|
||||||
private RequestMappingHandlerMethodAdapter handlerAdapter;
|
private RequestMappingHandlerAdapter handlerAdapter;
|
||||||
|
|
||||||
private MockHttpServletRequest request;
|
private MockHttpServletRequest request;
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class RequestMappingHandlerMethodAdapterTests {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
this.handlerAdapter = new RequestMappingHandlerMethodAdapter();
|
this.handlerAdapter = new RequestMappingHandlerAdapter();
|
||||||
this.handlerAdapter.setApplicationContext(new GenericWebApplicationContext());
|
this.handlerAdapter.setApplicationContext(new GenericWebApplicationContext());
|
||||||
this.handlerAdapter.afterPropertiesSet();
|
this.handlerAdapter.afterPropertiesSet();
|
||||||
|
|
||||||
|
|
@ -43,14 +43,14 @@ import org.springframework.web.servlet.handler.MappedInterceptor;
|
||||||
import org.springframework.web.util.UrlPathHelper;
|
import org.springframework.web.util.UrlPathHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test fixture with {@link RequestMappingHandlerMethodMapping}.
|
* Test fixture with {@link RequestMappingHandlerMapping}.
|
||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
*/
|
*/
|
||||||
public class RequestMappingHandlerMethodMappingTests {
|
public class RequestMappingHandlerMappingTests {
|
||||||
|
|
||||||
private RequestMappingHandlerMethodMapping mapping;
|
private RequestMappingHandlerMapping mapping;
|
||||||
|
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class RequestMappingHandlerMethodMappingTests {
|
||||||
StaticApplicationContext context = new StaticApplicationContext();
|
StaticApplicationContext context = new StaticApplicationContext();
|
||||||
context.registerSingleton("handler", handler.getClass());
|
context.registerSingleton("handler", handler.getClass());
|
||||||
|
|
||||||
mapping = new RequestMappingHandlerMethodMapping();
|
mapping = new RequestMappingHandlerMapping();
|
||||||
mapping.setApplicationContext(context);
|
mapping.setApplicationContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,7 +263,7 @@ public class ServletHandlerMethodTests {
|
||||||
csDef.getPropertyValues().add("converters", new TestBeanConverter());
|
csDef.getPropertyValues().add("converters", new TestBeanConverter());
|
||||||
RootBeanDefinition wbiDef = new RootBeanDefinition(ConfigurableWebBindingInitializer.class);
|
RootBeanDefinition wbiDef = new RootBeanDefinition(ConfigurableWebBindingInitializer.class);
|
||||||
wbiDef.getPropertyValues().add("conversionService", csDef);
|
wbiDef.getPropertyValues().add("conversionService", csDef);
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("webBindingInitializer", wbiDef);
|
adapterDef.getPropertyValues().add("webBindingInitializer", wbiDef);
|
||||||
context.registerBeanDefinition("handlerAdapter", adapterDef);
|
context.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +555,7 @@ public class ServletHandlerMethodTests {
|
||||||
initDispatcherServlet(MyCommandProvidingFormController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(MyCommandProvidingFormController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -575,7 +575,7 @@ public class ServletHandlerMethodTests {
|
||||||
initDispatcherServlet(MyTypedCommandProvidingFormController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(MyTypedCommandProvidingFormController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
|
||||||
List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||||
argumentResolvers.add(new ServletWebArgumentResolverAdapter(new MySpecialArgumentResolver()));
|
argumentResolvers.add(new ServletWebArgumentResolverAdapter(new MySpecialArgumentResolver()));
|
||||||
|
|
@ -817,7 +817,7 @@ public class ServletHandlerMethodTests {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
RootBeanDefinition converterDef = new RootBeanDefinition(StringHttpMessageConverter.class);
|
RootBeanDefinition converterDef = new RootBeanDefinition(StringHttpMessageConverter.class);
|
||||||
converterDef.getPropertyValues().add("supportedMediaTypes", new MediaType("text", "plain"));
|
converterDef.getPropertyValues().add("supportedMediaTypes", new MediaType("text", "plain"));
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
StringHttpMessageConverter converter = new StringHttpMessageConverter();
|
StringHttpMessageConverter converter = new StringHttpMessageConverter();
|
||||||
converter.setSupportedMediaTypes(Collections.singletonList(new MediaType("text", "plain")));
|
converter.setSupportedMediaTypes(Collections.singletonList(new MediaType("text", "plain")));
|
||||||
adapterDef.getPropertyValues().add("messageConverters", converter);
|
adapterDef.getPropertyValues().add("messageConverters", converter);
|
||||||
|
|
@ -853,7 +853,7 @@ public class ServletHandlerMethodTests {
|
||||||
public void unsupportedRequestBody() throws ServletException, IOException {
|
public void unsupportedRequestBody() throws ServletException, IOException {
|
||||||
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("messageConverters", new ByteArrayHttpMessageConverter());
|
adapterDef.getPropertyValues().add("messageConverters", new ByteArrayHttpMessageConverter());
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -887,7 +887,7 @@ public class ServletHandlerMethodTests {
|
||||||
public void badRequestRequestBody() throws ServletException, IOException {
|
public void badRequestRequestBody() throws ServletException, IOException {
|
||||||
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("messageConverters", new NotReadableMessageConverter());
|
adapterDef.getPropertyValues().add("messageConverters", new NotReadableMessageConverter());
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +933,7 @@ public class ServletHandlerMethodTests {
|
||||||
public void overlappingMesssageConvertersRequestBody() throws ServletException, IOException {
|
public void overlappingMesssageConvertersRequestBody() throws ServletException, IOException {
|
||||||
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(RequestResponseBodyController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
||||||
messageConverters.add(new StringHttpMessageConverter());
|
messageConverters.add(new StringHttpMessageConverter());
|
||||||
messageConverters
|
messageConverters
|
||||||
|
|
@ -977,7 +977,7 @@ public class ServletHandlerMethodTests {
|
||||||
}
|
}
|
||||||
MarshallingHttpMessageConverter messageConverter = new MarshallingHttpMessageConverter(marshaller);
|
MarshallingHttpMessageConverter messageConverter = new MarshallingHttpMessageConverter(marshaller);
|
||||||
|
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("messageConverters", messageConverter);
|
adapterDef.getPropertyValues().add("messageConverters", messageConverter);
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -1080,7 +1080,7 @@ public class ServletHandlerMethodTests {
|
||||||
public void mavResolver() throws ServletException, IOException {
|
public void mavResolver() throws ServletException, IOException {
|
||||||
initDispatcherServlet(ModelAndViewResolverController.class, new BeanDefinitionRegistrar() {
|
initDispatcherServlet(ModelAndViewResolverController.class, new BeanDefinitionRegistrar() {
|
||||||
public void register(GenericWebApplicationContext wac) {
|
public void register(GenericWebApplicationContext wac) {
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
ModelAndViewResolver[] mavResolvers = new ModelAndViewResolver[] {new MyModelAndViewResolver()};
|
ModelAndViewResolver[] mavResolvers = new ModelAndViewResolver[] {new MyModelAndViewResolver()};
|
||||||
adapterDef.getPropertyValues().add("modelAndViewResolvers", mavResolvers);
|
adapterDef.getPropertyValues().add("modelAndViewResolvers", mavResolvers);
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
|
|
@ -1335,7 +1335,7 @@ public class ServletHandlerMethodTests {
|
||||||
RootBeanDefinition csDef = new RootBeanDefinition(FormattingConversionServiceFactoryBean.class);
|
RootBeanDefinition csDef = new RootBeanDefinition(FormattingConversionServiceFactoryBean.class);
|
||||||
RootBeanDefinition wbiDef = new RootBeanDefinition(ConfigurableWebBindingInitializer.class);
|
RootBeanDefinition wbiDef = new RootBeanDefinition(ConfigurableWebBindingInitializer.class);
|
||||||
wbiDef.getPropertyValues().add("conversionService", csDef);
|
wbiDef.getPropertyValues().add("conversionService", csDef);
|
||||||
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerMethodAdapter.class);
|
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
|
||||||
adapterDef.getPropertyValues().add("webBindingInitializer", wbiDef);
|
adapterDef.getPropertyValues().add("webBindingInitializer", wbiDef);
|
||||||
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
wac.registerBeanDefinition("handlerAdapter", adapterDef);
|
||||||
}
|
}
|
||||||
|
|
@ -2630,10 +2630,10 @@ public class ServletHandlerMethodTests {
|
||||||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
|
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
|
||||||
|
|
||||||
Class<?> mappingType = RequestMappingHandlerMethodMapping.class;
|
Class<?> mappingType = RequestMappingHandlerMapping.class;
|
||||||
wac.registerBeanDefinition("handlerMapping", new RootBeanDefinition(mappingType));
|
wac.registerBeanDefinition("handlerMapping", new RootBeanDefinition(mappingType));
|
||||||
|
|
||||||
Class<?> adapterType = RequestMappingHandlerMethodAdapter.class;
|
Class<?> adapterType = RequestMappingHandlerAdapter.class;
|
||||||
wac.registerBeanDefinition("handlerAdapter", new RootBeanDefinition(adapterType));
|
wac.registerBeanDefinition("handlerAdapter", new RootBeanDefinition(adapterType));
|
||||||
|
|
||||||
Class<?> resolverType = ExceptionHandlerExceptionResolver.class;
|
Class<?> resolverType = ExceptionHandlerExceptionResolver.class;
|
||||||
|
|
|
||||||
|
|
@ -601,10 +601,10 @@ public class UriTemplateServletHandlerMethodTests {
|
||||||
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
GenericWebApplicationContext wac = new GenericWebApplicationContext();
|
||||||
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
|
wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
|
||||||
|
|
||||||
Class<?> mappingType = RequestMappingHandlerMethodMapping.class;
|
Class<?> mappingType = RequestMappingHandlerMapping.class;
|
||||||
wac.registerBeanDefinition("handlerMapping", new RootBeanDefinition(mappingType));
|
wac.registerBeanDefinition("handlerMapping", new RootBeanDefinition(mappingType));
|
||||||
|
|
||||||
Class<?> adapterType = RequestMappingHandlerMethodAdapter.class;
|
Class<?> adapterType = RequestMappingHandlerAdapter.class;
|
||||||
wac.registerBeanDefinition("handlerAdapter", new RootBeanDefinition(adapterType));
|
wac.registerBeanDefinition("handlerAdapter", new RootBeanDefinition(adapterType));
|
||||||
|
|
||||||
Class<?> resolverType = ExceptionHandlerExceptionResolver.class;
|
Class<?> resolverType = ExceptionHandlerExceptionResolver.class;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue