Java Code Examples for org.springframework.web.util.UrlPathHelper#setUrlDecode()

The following examples show how to use org.springframework.web.util.UrlPathHelper#setUrlDecode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequestMappingInfoHandlerMappingTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test  // SPR-9098
public void handleMatchUriTemplateVariablesDecode() {
	RequestMappingInfo key = RequestMappingInfo.paths("/{group}/{identifier}").build();
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/group/a%2Fb");

	UrlPathHelper pathHelper = new UrlPathHelper();
	pathHelper.setUrlDecode(false);
	String lookupPath = pathHelper.getLookupPathForRequest(request);

	this.handlerMapping.setUrlPathHelper(pathHelper);
	this.handlerMapping.handleMatch(key, lookupPath, request);

	String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
	Map<String, String> uriVariables = (Map<String, String>) request.getAttribute(name);

	assertNotNull(uriVariables);
	assertEquals("group", uriVariables.get("group"));
	assertEquals("a/b", uriVariables.get("identifier"));
}
 
Example 2
Source File: RequestMappingInfoHandlerMappingTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test  // SPR-9098
public void handleMatchUriTemplateVariablesDecode() {
	RequestMappingInfo key = RequestMappingInfo.paths("/{group}/{identifier}").build();
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/group/a%2Fb");

	UrlPathHelper pathHelper = new UrlPathHelper();
	pathHelper.setUrlDecode(false);
	String lookupPath = pathHelper.getLookupPathForRequest(request);

	this.handlerMapping.setUrlPathHelper(pathHelper);
	this.handlerMapping.handleMatch(key, lookupPath, request);

	String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
	Map<String, String> uriVariables = (Map<String, String>) request.getAttribute(name);

	assertNotNull(uriVariables);
	assertEquals("group", uriVariables.get("group"));
	assertEquals("a/b", uriVariables.get("identifier"));
}
 
Example 3
Source File: RequestMappingInfoHandlerMappingTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void uriTemplateVariablesDecode() {
	PatternsRequestCondition patterns = new PatternsRequestCondition("/{group}/{identifier}");
	RequestMappingInfo key = new RequestMappingInfo(patterns, null, null, null, null, null, null);
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/group/a%2Fb");

	UrlPathHelper pathHelper = new UrlPathHelper();
	pathHelper.setUrlDecode(false);
	String lookupPath = pathHelper.getLookupPathForRequest(request);

	this.handlerMapping.setUrlPathHelper(pathHelper);
	this.handlerMapping.handleMatch(key, lookupPath, request);

	@SuppressWarnings("unchecked")
	Map<String, String> uriVariables =
		(Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);

	assertNotNull(uriVariables);
	assertEquals("group", uriVariables.get("group"));
	assertEquals("a/b", uriVariables.get("identifier"));
}
 
Example 4
Source File: ComplianceApplication.java    From pacbot with Apache License 2.0 5 votes vote down vote up
/**
 * Configures the PathMatchConfigurer with  UrlPathHelper
 * @param configurer PathMatchConfigurer
 */
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 5
Source File: StatisticsApplication.java    From pacbot with Apache License 2.0 5 votes vote down vote up
/**
 * Configures the PathMatchConfigurer with  UrlPathHelper
 * @param configurer PathMatchConfigurer
 */
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 6
Source File: AssetApplication.java    From pacbot with Apache License 2.0 5 votes vote down vote up
/**
 * Configures the PathMatchConfigurer with  UrlPathHelper
 * @param configurer PathMatchConfigurer
 */
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 7
Source File: PresentationConfiguration.java    From hesperides with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
    configurer.setUseSuffixPatternMatch(false); // avoids bug with getInstanceFiles when instance name ends with .digit and it gets mangled
}
 
Example 8
Source File: LiteWebConfiguration.java    From singleton with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
	UrlPathHelper urlPathHelper = new UrlPathHelper();
	urlPathHelper.setUrlDecode(false);
	configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 9
Source File: WebConfiguration.java    From singleton with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 10
Source File: WebConfiguration.java    From singleton with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
	UrlPathHelper urlPathHelper = new UrlPathHelper();
	urlPathHelper.setUrlDecode(false);
	configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 11
Source File: WebConfig.java    From api-layer with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 12
Source File: WebConfiguration.java    From api-layer with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}
 
Example 13
Source File: PathMatchingConfigurationAdapter.java    From Pixiv-Illustration-Collection-Backend with Apache License 2.0 4 votes vote down vote up
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    urlPathHelper.setUrlDecode(false);
    configurer.setUrlPathHelper(urlPathHelper);
}