Java Code Examples for org.springframework.web.reactive.result.method.RequestMappingInfo#getMatchingCondition()
The following examples show how to use
org.springframework.web.reactive.result.method.RequestMappingInfo#getMatchingCondition() .
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: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 6 votes |
@Test @Ignore public void preFlightRequest() throws Exception { MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.options("/foo") .header("Origin", "https://domain.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "POST") ); RequestMappingInfo info = paths("/foo").methods(RequestMethod.POST).build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").methods(RequestMethod.OPTIONS).build(); match = info.getMatchingCondition(exchange); assertNull("Pre-flight should match the ACCESS_CONTROL_REQUEST_METHOD", match); }
Example 2
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 6 votes |
@Test @Ignore public void preFlightRequest() throws Exception { MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.options("/foo") .header("Origin", "http://domain.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "POST") ); RequestMappingInfo info = paths("/foo").methods(RequestMethod.POST).build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").methods(RequestMethod.OPTIONS).build(); match = info.getMatchingCondition(exchange); assertNull("Pre-flight should match the ACCESS_CONTROL_REQUEST_METHOD", match); }
Example 3
Source File: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void matchParamsCondition() { ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/foo?foo=bar")); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").params("foo!=bar").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 4
Source File: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void matchHeadersCondition() { MockServerHttpRequest request = MockServerHttpRequest.get("/foo").header("foo", "bar").build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").headers("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").headers("foo!=bar").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 5
Source File: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void matchConsumesCondition() { MockServerHttpRequest request = MockServerHttpRequest.post("/foo").contentType(MediaType.TEXT_PLAIN).build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").consumes("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").consumes("application/xml").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 6
Source File: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void matchProducesCondition() { MockServerHttpRequest request = MockServerHttpRequest.get("/foo").accept(MediaType.TEXT_PLAIN).build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").produces("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").produces("application/xml").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 7
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void matchParamsCondition() { ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/foo?foo=bar")); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").params("foo!=bar").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 8
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void matchHeadersCondition() { MockServerHttpRequest request = MockServerHttpRequest.get("/foo").header("foo", "bar").build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").headers("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").headers("foo!=bar").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 9
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void matchConsumesCondition() { MockServerHttpRequest request = MockServerHttpRequest.post("/foo").contentType(MediaType.TEXT_PLAIN).build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").consumes("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").consumes("application/xml").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 10
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void matchProducesCondition() { MockServerHttpRequest request = MockServerHttpRequest.get("/foo").accept(MediaType.TEXT_PLAIN).build(); ServerWebExchange exchange = MockServerWebExchange.from(request); RequestMappingInfo info = paths("/foo").produces("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").produces("application/xml").build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 11
Source File: RequestMappingInfoTests.java From spring-analysis-note with MIT License | 4 votes |
@Test public void matchCustomCondition() { ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/foo?foo=bar")); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").params("foo!=bar") .customCondition(new ParamsRequestCondition("foo!=bar")).build(); match = info.getMatchingCondition(exchange); assertNull(match); }
Example 12
Source File: RequestMappingInfoTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void matchCustomCondition() { ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/foo?foo=bar")); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); assertNotNull(match); info = paths("/foo").params("foo!=bar") .customCondition(new ParamsRequestCondition("foo!=bar")).build(); match = info.getMatchingCondition(exchange); assertNull(match); }