use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project spring-framework by spring-projects.
the class MvcNamespaceTests method doTestCustomValidator.
private void doTestCustomValidator(String xml) throws Exception {
loadBeanDefinitions(xml, 14);
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
assertNotNull(mapping);
assertFalse(mapping.getUrlPathHelper().shouldRemoveSemicolonContent());
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
assertNotNull(adapter);
assertEquals(true, new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect"));
// default web binding initializer behavior test
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("date", "2009-10-31");
MockHttpServletResponse response = new MockHttpServletResponse();
adapter.handle(request, response, handlerMethod);
assertTrue(appContext.getBean(TestValidator.class).validatorInvoked);
assertFalse(handler.recordedValidationError);
}
use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project spring-framework by spring-projects.
the class MvcNamespaceTests method testPathMatchingHandlerMappings.
@Test
public void testPathMatchingHandlerMappings() throws Exception {
loadBeanDefinitions("mvc-config-path-matching-mappings.xml", 23);
RequestMappingHandlerMapping requestMapping = appContext.getBean(RequestMappingHandlerMapping.class);
assertNotNull(requestMapping);
assertEquals(TestPathHelper.class, requestMapping.getUrlPathHelper().getClass());
assertEquals(TestPathMatcher.class, requestMapping.getPathMatcher().getClass());
SimpleUrlHandlerMapping viewController = appContext.getBean(VIEWCONTROLLER_BEAN_NAME, SimpleUrlHandlerMapping.class);
assertNotNull(viewController);
assertEquals(TestPathHelper.class, viewController.getUrlPathHelper().getClass());
assertEquals(TestPathMatcher.class, viewController.getPathMatcher().getClass());
for (SimpleUrlHandlerMapping handlerMapping : appContext.getBeansOfType(SimpleUrlHandlerMapping.class).values()) {
assertNotNull(handlerMapping);
assertEquals(TestPathHelper.class, handlerMapping.getUrlPathHelper().getClass());
assertEquals(TestPathMatcher.class, handlerMapping.getPathMatcher().getClass());
}
}
use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project Activiti by Activiti.
the class DispatcherServletConfiguration method requestMappingHandlerMapping.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
log.debug("Creating requestMappingHandlerMapping");
RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
requestMappingHandlerMapping.setUseSuffixPatternMatch(false);
Object[] interceptors = { localeChangeInterceptor() };
requestMappingHandlerMapping.setInterceptors(interceptors);
return requestMappingHandlerMapping;
}
use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project spring-mvc-31-demo by rstoyanchev.
the class WebConfig method requestMappingHandlerMapping.
// Configuration for custom @RequestMapping condition
// See ~.requestcondition package
@Override
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
RequestMappingHandlerMapping handlerMapping = new ExtendedRequestMappingHandlerMapping();
handlerMapping.setOrder(0);
handlerMapping.setInterceptors(getInterceptors());
return handlerMapping;
}
use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project spring-framework by spring-projects.
the class WebMvcConfigurationSupport method requestMappingHandlerMapping.
/**
* Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
* requests to annotated controllers.
*/
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
RequestMappingHandlerMapping handlerMapping = createRequestMappingHandlerMapping();
handlerMapping.setOrder(0);
handlerMapping.setInterceptors(getInterceptors());
handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager());
handlerMapping.setCorsConfigurations(getCorsConfigurations());
PathMatchConfigurer configurer = getPathMatchConfigurer();
if (configurer.isUseSuffixPatternMatch() != null) {
handlerMapping.setUseSuffixPatternMatch(configurer.isUseSuffixPatternMatch());
}
if (configurer.isUseRegisteredSuffixPatternMatch() != null) {
handlerMapping.setUseRegisteredSuffixPatternMatch(configurer.isUseRegisteredSuffixPatternMatch());
}
if (configurer.isUseTrailingSlashMatch() != null) {
handlerMapping.setUseTrailingSlashMatch(configurer.isUseTrailingSlashMatch());
}
UrlPathHelper pathHelper = configurer.getUrlPathHelper();
if (pathHelper != null) {
handlerMapping.setUrlPathHelper(pathHelper);
}
PathMatcher pathMatcher = configurer.getPathMatcher();
if (pathMatcher != null) {
handlerMapping.setPathMatcher(pathMatcher);
}
return handlerMapping;
}
Aggregations