Example usage for org.springframework.web.servlet.mvc.method.annotation RequestMappingHandlerMapping setUseRegisteredSuffixPatternMatch

List of usage examples for org.springframework.web.servlet.mvc.method.annotation RequestMappingHandlerMapping setUseRegisteredSuffixPatternMatch

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.method.annotation RequestMappingHandlerMapping setUseRegisteredSuffixPatternMatch.

Prototype

public void setUseRegisteredSuffixPatternMatch(boolean useRegisteredSuffixPatternMatch) 

Source Link

Document

Whether suffix pattern matching should work only against path extensions explicitly registered with the ContentNegotiationManager .

Usage

From source file:com.kixeye.chassis.transport.SpringMvcConfiguration.java

/**
 * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
 * requests to annotated controllers./* w w  w. jav  a 2 s .co m*/
 */
@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;
}