use of org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping in project spring-framework by spring-projects.
the class StandaloneMockMvcBuilderTests method suffixPatternMatch.
// SPR-13637
@Test
public void suffixPatternMatch() throws Exception {
TestStandaloneMockMvcBuilder builder = new TestStandaloneMockMvcBuilder(new PersonController());
builder.setUseSuffixPatternMatch(false);
builder.build();
RequestMappingHandlerMapping hm = builder.wac.getBean(RequestMappingHandlerMapping.class);
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/persons");
HandlerExecutionChain chain = hm.getHandler(request);
assertNotNull(chain);
assertEquals("persons", ((HandlerMethod) chain.getHandler()).getMethod().getName());
request = new MockHttpServletRequest("GET", "/persons.xml");
chain = hm.getHandler(request);
assertNull(chain);
}
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 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 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 chassis by Kixeye.
the class SpringMvcConfiguration method requestMappingHandlerMapping.
/**
* Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
* requests to annotated controllers.
*/
@Bean
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
PathMatchConfigurer configurer = new PathMatchConfigurer();
configurePathMatch(configurer);
RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
handlerMapping.setOrder(0);
handlerMapping.setDetectHandlerMethodsInAncestorContexts(true);
handlerMapping.setInterceptors(getInterceptors());
handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager());
if (configurer.isUseSuffixPatternMatch() != null) {
handlerMapping.setUseSuffixPatternMatch(configurer.isUseSuffixPatternMatch());
}
if (configurer.isUseRegisteredSuffixPatternMatch() != null) {
handlerMapping.setUseRegisteredSuffixPatternMatch(configurer.isUseRegisteredSuffixPatternMatch());
}
if (configurer.isUseTrailingSlashMatch() != null) {
handlerMapping.setUseTrailingSlashMatch(configurer.isUseTrailingSlashMatch());
}
if (configurer.getPathMatcher() != null) {
handlerMapping.setPathMatcher(configurer.getPathMatcher());
}
if (configurer.getUrlPathHelper() != null) {
handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper());
}
return handlerMapping;
}
Aggregations