org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#setUseTrailingSlashMatch ( )源码实例Demo

下面列出了org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#setUseTrailingSlashMatch ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public RequestMappingHandlerMapping getHandlerMapping(
		FormattingConversionService mvcConversionService,
		ResourceUrlProvider mvcResourceUrlProvider) {
	RequestMappingHandlerMapping handlerMapping = handlerMappingFactory.get();
	handlerMapping.setEmbeddedValueResolver(new StaticStringValueResolver(placeholderValues));
	handlerMapping.setUseSuffixPatternMatch(useSuffixPatternMatch);
	handlerMapping.setUseTrailingSlashMatch(useTrailingSlashPatternMatch);
	handlerMapping.setOrder(0);
	handlerMapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
	if (removeSemicolonContent != null) {
		handlerMapping.setRemoveSemicolonContent(removeSemicolonContent);
	}
	return handlerMapping;
}
 
/**
 * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
 * requests to annotated controllers.
 */
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
	RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
	mapping.setOrder(0);
	mapping.setInterceptors(getInterceptors());
	mapping.setContentNegotiationManager(mvcContentNegotiationManager());
	mapping.setCorsConfigurations(getCorsConfigurations());

	PathMatchConfigurer configurer = getPathMatchConfigurer();

	Boolean useSuffixPatternMatch = configurer.isUseSuffixPatternMatch();
	if (useSuffixPatternMatch != null) {
		mapping.setUseSuffixPatternMatch(useSuffixPatternMatch);
	}
	Boolean useRegisteredSuffixPatternMatch = configurer.isUseRegisteredSuffixPatternMatch();
	if (useRegisteredSuffixPatternMatch != null) {
		mapping.setUseRegisteredSuffixPatternMatch(useRegisteredSuffixPatternMatch);
	}
	Boolean useTrailingSlashMatch = configurer.isUseTrailingSlashMatch();
	if (useTrailingSlashMatch != null) {
		mapping.setUseTrailingSlashMatch(useTrailingSlashMatch);
	}

	UrlPathHelper pathHelper = configurer.getUrlPathHelper();
	if (pathHelper != null) {
		mapping.setUrlPathHelper(pathHelper);
	}
	PathMatcher pathMatcher = configurer.getPathMatcher();
	if (pathMatcher != null) {
		mapping.setPathMatcher(pathMatcher);
	}
	Map<String, Predicate<Class<?>>> pathPrefixes = configurer.getPathPrefixes();
	if (pathPrefixes != null) {
		mapping.setPathPrefixes(pathPrefixes);
	}

	return mapping;
}
 
public RequestMappingHandlerMapping getHandlerMapping() {
	RequestMappingHandlerMapping handlerMapping = handlerMappingFactory.get();
	handlerMapping.setEmbeddedValueResolver(new StaticStringValueResolver(placeholderValues));
	handlerMapping.setUseSuffixPatternMatch(useSuffixPatternMatch);
	handlerMapping.setUseTrailingSlashMatch(useTrailingSlashPatternMatch);
	handlerMapping.setOrder(0);
	handlerMapping.setInterceptors(getInterceptors());
	if (removeSemicolonContent != null) {
		handlerMapping.setRemoveSemicolonContent(removeSemicolonContent);
	}
	return handlerMapping;
}
 
源代码4 项目: lams   文件: WebMvcConfigurationSupport.java
/**
 * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
 * requests to annotated controllers.
 */
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
	RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
	mapping.setOrder(0);
	mapping.setInterceptors(getInterceptors());
	mapping.setContentNegotiationManager(mvcContentNegotiationManager());
	mapping.setCorsConfigurations(getCorsConfigurations());

	PathMatchConfigurer configurer = getPathMatchConfigurer();
	if (configurer.isUseSuffixPatternMatch() != null) {
		mapping.setUseSuffixPatternMatch(configurer.isUseSuffixPatternMatch());
	}
	if (configurer.isUseRegisteredSuffixPatternMatch() != null) {
		mapping.setUseRegisteredSuffixPatternMatch(configurer.isUseRegisteredSuffixPatternMatch());
	}
	if (configurer.isUseTrailingSlashMatch() != null) {
		mapping.setUseTrailingSlashMatch(configurer.isUseTrailingSlashMatch());
	}
	UrlPathHelper pathHelper = configurer.getUrlPathHelper();
	if (pathHelper != null) {
		mapping.setUrlPathHelper(pathHelper);
	}
	PathMatcher pathMatcher = configurer.getPathMatcher();
	if (pathMatcher != null) {
		mapping.setPathMatcher(pathMatcher);
	}

	return mapping;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
// FIXME: FInd out what this is and why it is here.
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = new RequestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
/**
 * 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());
	}
	if (configurer.getPathMatcher() != null) {
		handlerMapping.setPathMatcher(configurer.getPathMatcher());
	}
	if (configurer.getUrlPathHelper() != null) {
		handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper());
	}

	return handlerMapping;
}
 
源代码13 项目: chassis   文件: SpringMvcConfiguration.java
/**
 * 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;
}
 
源代码14 项目: maven-framework-project   文件: WebMvcConfig.java
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
@Bean
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = super.requestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
源代码15 项目: maven-framework-project   文件: WebMvcConfig.java
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
@Bean
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = super.requestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
源代码16 项目: maven-framework-project   文件: WebMvcConfig.java
/**
 * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
 * controllers. For example, once security has been applied for administrators try commenting out the modifications
 * to the super class and requesting <a
 * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
 * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
 * how to secure the service tier which helps mitigate bypassing of the URL based security too.
 */
@Bean
@Override
public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    RequestMappingHandlerMapping result = super.requestMappingHandlerMapping();
    result.setUseSuffixPatternMatch(false);
    result.setUseTrailingSlashMatch(false);
    return result;
}
 
源代码17 项目: maven-framework-project   文件: WebMvcConfig.java
/**
     * We mention this in the book, but this helps to ensure that the intercept-url patterns prevent access to our
     * controllers. For example, once security has been applied for administrators try commenting out the modifications
     * to the super class and requesting <a
     * href="http://localhost:800/calendar/events/.html">http://localhost:800/calendar/events/.html</a>. You will
     * observe that security is bypassed since it did not match the pattern we provided. In later chapters, we discuss
     * how to secure the service tier which helps mitigate bypassing of the URL based security too.
     */
    @Bean
    @Override
    public RequestMappingHandlerMapping requestMappingHandlerMapping() {
        RequestMappingHandlerMapping result = super.requestMappingHandlerMapping();
//        result.setUseSuffixPatternMatch(false);
        result.setUseTrailingSlashMatch(false);
        return result;
    }
 
/**
 * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
 * requests to annotated controllers.
 */
@Bean
public RequestMappingHandlerMapping requestMappingHandlerMapping(
		ContentNegotiationManager mvcContentNegotiationManager,
		FormattingConversionService mvcConversionService,
		ResourceUrlProvider mvcResourceUrlProvider) {
	RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
	mapping.setOrder(0);
	mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
	mapping.setContentNegotiationManager(mvcContentNegotiationManager);
	mapping.setCorsConfigurations(getCorsConfigurations());

	PathMatchConfigurer configurer = getPathMatchConfigurer();

	Boolean useSuffixPatternMatch = configurer.isUseSuffixPatternMatch();
	if (useSuffixPatternMatch != null) {
		mapping.setUseSuffixPatternMatch(useSuffixPatternMatch);
	}
	Boolean useRegisteredSuffixPatternMatch = configurer.isUseRegisteredSuffixPatternMatch();
	if (useRegisteredSuffixPatternMatch != null) {
		mapping.setUseRegisteredSuffixPatternMatch(useRegisteredSuffixPatternMatch);
	}
	Boolean useTrailingSlashMatch = configurer.isUseTrailingSlashMatch();
	if (useTrailingSlashMatch != null) {
		mapping.setUseTrailingSlashMatch(useTrailingSlashMatch);
	}

	UrlPathHelper pathHelper = configurer.getUrlPathHelper();
	if (pathHelper != null) {
		mapping.setUrlPathHelper(pathHelper);
	}
	PathMatcher pathMatcher = configurer.getPathMatcher();
	if (pathMatcher != null) {
		mapping.setPathMatcher(pathMatcher);
	}
	Map<String, Predicate<Class<?>>> pathPrefixes = configurer.getPathPrefixes();
	if (pathPrefixes != null) {
		mapping.setPathPrefixes(pathPrefixes);
	}

	return mapping;
}