Java Code Examples for org.springframework.web.reactive.HandlerMapping#URI_TEMPLATE_VARIABLES_ATTRIBUTE
The following examples show how to use
org.springframework.web.reactive.HandlerMapping#URI_TEMPLATE_VARIABLES_ATTRIBUTE .
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 |
@Test // SPR-9098 public void handleMatchUriTemplateVariablesDecode() { RequestMappingInfo key = paths("/{group}/{identifier}").build(); URI url = URI.create("/group/a%2Fb"); ServerWebExchange exchange = MockServerWebExchange.from(method(HttpMethod.GET, url)); this.handlerMapping.handleMatch(key, handlerMethod, exchange); String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; @SuppressWarnings("unchecked") Map<String, String> uriVariables = (Map<String, String>) exchange.getAttributes().get(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 |
@Test // SPR-9098 public void handleMatchUriTemplateVariablesDecode() { RequestMappingInfo key = paths("/{group}/{identifier}").build(); URI url = URI.create("/group/a%2Fb"); ServerWebExchange exchange = MockServerWebExchange.from(method(HttpMethod.GET, url)); this.handlerMapping.handleMatch(key, handlerMethod, exchange); String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; @SuppressWarnings("unchecked") Map<String, String> uriVariables = (Map<String, String>) exchange.getAttributes().get(name); assertNotNull(uriVariables); assertEquals("group", uriVariables.get("group")); assertEquals("a/b", uriVariables.get("identifier")); }
Example 3
Source File: PathVariableMapMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public Object resolveArgumentValue( MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) { String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(name, Collections.emptyMap()); }
Example 4
Source File: RequestMappingInfoHandlerMappingTests.java From spring-analysis-note with MIT License | 5 votes |
@Test @SuppressWarnings("unchecked") public void handleMatchUriTemplateVariables() { ServerWebExchange exchange = MockServerWebExchange.from(get("/1/2")); RequestMappingInfo key = paths("/{path1}/{path2}").build(); this.handlerMapping.handleMatch(key, handlerMethod, exchange); String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; Map<String, String> uriVariables = (Map<String, String>) exchange.getAttributes().get(name); assertNotNull(uriVariables); assertEquals("1", uriVariables.get("path1")); assertEquals("2", uriVariables.get("path2")); }
Example 5
Source File: PathVariableMapMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
@Override public Object resolveArgumentValue( MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) { String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(name, Collections.emptyMap()); }
Example 6
Source File: RequestMappingInfoHandlerMappingTests.java From java-technology-stack with MIT License | 5 votes |
@Test @SuppressWarnings("unchecked") public void handleMatchUriTemplateVariables() { ServerWebExchange exchange = MockServerWebExchange.from(get("/1/2")); RequestMappingInfo key = paths("/{path1}/{path2}").build(); this.handlerMapping.handleMatch(key, handlerMethod, exchange); String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; Map<String, String> uriVariables = (Map<String, String>) exchange.getAttributes().get(name); assertNotNull(uriVariables); assertEquals("1", uriVariables.get("path1")); assertEquals("2", uriVariables.get("path2")); }
Example 7
Source File: RedirectView.java From spring-analysis-note with MIT License | 4 votes |
@SuppressWarnings("unchecked") private Map<String, String> getCurrentUriVariables(ServerWebExchange exchange) { String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(name, Collections.<String, String>emptyMap()); }
Example 8
Source File: PathVariableMethodArgumentResolver.java From spring-analysis-note with MIT License | 4 votes |
@Override @SuppressWarnings("unchecked") protected Object resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange) { String attributeName = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(attributeName, Collections.emptyMap()).get(name); }
Example 9
Source File: RedirectView.java From java-technology-stack with MIT License | 4 votes |
@SuppressWarnings("unchecked") private Map<String, String> getCurrentUriVariables(ServerWebExchange exchange) { String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(name, Collections.<String, String>emptyMap()); }
Example 10
Source File: PathVariableMethodArgumentResolver.java From java-technology-stack with MIT License | 4 votes |
@Override @SuppressWarnings("unchecked") protected Object resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange) { String attributeName = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; return exchange.getAttributeOrDefault(attributeName, Collections.emptyMap()).get(name); }