提交 aac20b3f 编写于 作者: A Arjen Poutsma

Move functional web framework to web.reactive.function.server

上级 aa8f5315
/**
* Types that make up Spring's functional web framework.
*/
package org.springframework.web.reactive.function;
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.time.ZoneId; import java.time.ZoneId;
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.function.Function; import java.util.function.Function;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.reactive.function.support.ServerRequestWrapper; import org.springframework.web.reactive.function.server.support.ServerRequestWrapper;
/** /**
* Represents a function that filters a {@linkplain HandlerFunction handler function}. * Represents a function that filters a {@linkplain HandlerFunction handler function}.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Stream; import java.util.stream.Stream;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.io.IOException; import java.io.IOException;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;
...@@ -107,7 +107,7 @@ class PathResourceLookupFunction implements Function<ServerRequest, Mono<Resourc ...@@ -107,7 +107,7 @@ class PathResourceLookupFunction implements Function<ServerRequest, Mono<Resourc
return true; return true;
} }
} }
if (path.contains("..")) { if (path.contains("")) {
path = StringUtils.cleanPath(path); path = StringUtils.cleanPath(path);
if (path.contains("../")) { if (path.contains("../")) {
return true; return true;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import org.springframework.util.Assert; import org.springframework.util.Assert;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.Optional; import java.util.Optional;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
...@@ -25,6 +25,8 @@ import org.springframework.core.io.Resource; ...@@ -25,6 +25,8 @@ import org.springframework.core.io.Resource;
import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter;
import org.springframework.web.reactive.function.server.support.ServerResponseResultHandler;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebHandler; import org.springframework.web.server.WebHandler;
import org.springframework.web.server.adapter.HttpWebHandlerAdapter; import org.springframework.web.server.adapter.HttpWebHandlerAdapter;
...@@ -205,8 +207,8 @@ public abstract class RouterFunctions { ...@@ -205,8 +207,8 @@ public abstract class RouterFunctions {
* {@link org.springframework.web.reactive.DispatcherHandler}. * {@link org.springframework.web.reactive.DispatcherHandler}.
* @param routerFunction the router function to convert * @param routerFunction the router function to convert
* @return an handler mapping that maps HTTP request to a handler using the given router function * @return an handler mapping that maps HTTP request to a handler using the given router function
* @see org.springframework.web.reactive.function.support.HandlerFunctionAdapter * @see HandlerFunctionAdapter
* @see org.springframework.web.reactive.function.support.ServerResponseResultHandler * @see ServerResponseResultHandler
*/ */
public static HandlerMapping toHandlerMapping(RouterFunction<?> routerFunction) { public static HandlerMapping toHandlerMapping(RouterFunction<?> routerFunction) {
return toHandlerMapping(routerFunction, HandlerStrategies.withDefaults()); return toHandlerMapping(routerFunction, HandlerStrategies.withDefaults());
...@@ -220,8 +222,8 @@ public abstract class RouterFunctions { ...@@ -220,8 +222,8 @@ public abstract class RouterFunctions {
* @param routerFunction the router function to convert * @param routerFunction the router function to convert
* @param strategies the strategies to use * @param strategies the strategies to use
* @return an handler mapping that maps HTTP request to a handler using the given router function * @return an handler mapping that maps HTTP request to a handler using the given router function
* @see org.springframework.web.reactive.function.support.HandlerFunctionAdapter * @see HandlerFunctionAdapter
* @see org.springframework.web.reactive.function.support.ServerResponseResultHandler * @see ServerResponseResultHandler
*/ */
public static HandlerMapping toHandlerMapping(RouterFunction<?> routerFunction, HandlerStrategies strategies) { public static HandlerMapping toHandlerMapping(RouterFunction<?> routerFunction, HandlerStrategies strategies) {
Assert.notNull(routerFunction, "RouterFunction must not be null"); Assert.notNull(routerFunction, "RouterFunction must not be null");
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
......
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Types that make up Spring's functional web framework.
*/
package org.springframework.web.reactive.function.server;
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function.support; package org.springframework.web.reactive.function.server.support;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -23,9 +23,9 @@ import reactor.core.publisher.Mono; ...@@ -23,9 +23,9 @@ import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.web.reactive.HandlerAdapter; import org.springframework.web.reactive.HandlerAdapter;
import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.function.HandlerFunction; import org.springframework.web.reactive.function.server.HandlerFunction;
import org.springframework.web.reactive.function.RouterFunctions; import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.ServerRequest; import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
/** /**
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function.support; package org.springframework.web.reactive.function.server.support;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
...@@ -34,8 +34,8 @@ import org.springframework.http.MediaType; ...@@ -34,8 +34,8 @@ import org.springframework.http.MediaType;
import org.springframework.http.codec.BodyExtractor; import org.springframework.http.codec.BodyExtractor;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.reactive.function.HandlerFunction; import org.springframework.web.reactive.function.server.HandlerFunction;
import org.springframework.web.reactive.function.ServerRequest; import org.springframework.web.reactive.function.server.ServerRequest;
/** /**
* Implementation of the {@link ServerRequest} interface that can be subclassed to adapt the request to a * Implementation of the {@link ServerRequest} interface that can be subclassed to adapt the request to a
......
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function.support; package org.springframework.web.reactive.function.server.support;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.HandlerResultHandler; import org.springframework.web.reactive.HandlerResultHandler;
import org.springframework.web.reactive.function.HandlerStrategies; import org.springframework.web.reactive.function.server.HandlerStrategies;
import org.springframework.web.reactive.function.ServerResponse; import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
/** /**
......
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** /**
* Classes supporting the {@code org.springframework.web.reactive.function} package. * Classes supporting the {@code org.springframework.web.reactive.function} package.
* Contains a {@code HandlerAdapter} that supports {@code HandlerFunction}s, * Contains a {@code HandlerAdapter} that supports {@code HandlerFunction}s,
* a {@code HandlerResultHandler} that supports {@code ServerResponse}s, and * a {@code HandlerResultHandler} that supports {@code ServerResponse}s, and
* a {@code ServerRequest} wrapper to adapt a request. * a {@code ServerRequest} wrapper to adapt a request.
*/ */
package org.springframework.web.reactive.function.support; package org.springframework.web.reactive.function.server.support;
\ No newline at end of file \ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests; import org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests;
import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.HttpHandler;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.List; import java.util.List;
import java.util.function.Supplier; import java.util.function.Supplier;
...@@ -42,15 +42,15 @@ import org.springframework.web.reactive.DispatcherHandler; ...@@ -42,15 +42,15 @@ import org.springframework.web.reactive.DispatcherHandler;
import org.springframework.web.reactive.HandlerAdapter; import org.springframework.web.reactive.HandlerAdapter;
import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.config.WebReactiveConfigurationSupport; import org.springframework.web.reactive.config.WebReactiveConfigurationSupport;
import org.springframework.web.reactive.function.support.HandlerFunctionAdapter; import org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter;
import org.springframework.web.reactive.function.support.ServerResponseResultHandler; import org.springframework.web.reactive.function.server.support.ServerResponseResultHandler;
import org.springframework.web.reactive.result.view.ViewResolver; import org.springframework.web.reactive.result.view.ViewResolver;
import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.springframework.http.codec.BodyInserters.fromObject; import static org.springframework.http.codec.BodyInserters.fromObject;
import static org.springframework.http.codec.BodyInserters.fromPublisher; import static org.springframework.http.codec.BodyInserters.fromPublisher;
import static org.springframework.web.reactive.function.RouterFunctions.route; import static org.springframework.web.reactive.function.server.RouterFunctions.route;
/** /**
* Tests the use of {@link HandlerFunction} and {@link RouterFunction} in a * Tests the use of {@link HandlerFunction} and {@link RouterFunction} in a
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -36,7 +36,8 @@ import org.springframework.http.ReactiveHttpOutputMessage; ...@@ -36,7 +36,8 @@ import org.springframework.http.ReactiveHttpOutputMessage;
import org.springframework.http.codec.HttpMessageReader; import org.springframework.http.codec.HttpMessageReader;
import org.springframework.http.codec.HttpMessageWriter; import org.springframework.http.codec.HttpMessageWriter;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -30,7 +30,7 @@ import org.junit.Test; ...@@ -30,7 +30,7 @@ import org.junit.Test;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRange; import org.springframework.http.HttpRange;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.support.ServerRequestWrapper; import org.springframework.web.reactive.function.server.support.ServerRequestWrapper;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -34,9 +34,10 @@ public class PathResourceLookupFunctionTests { ...@@ -34,9 +34,10 @@ public class PathResourceLookupFunctionTests {
@Test @Test
public void normal() throws Exception { public void normal() throws Exception {
ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/"); ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/server/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); PathResourceLookupFunction
function = new PathResourceLookupFunction("/resources/**", location);
MockServerRequest request = MockServerRequest.builder() MockServerRequest request = MockServerRequest.builder()
.uri(new URI("http://localhost/resources/response.txt")) .uri(new URI("http://localhost/resources/response.txt"))
.build(); .build();
...@@ -58,14 +59,14 @@ public class PathResourceLookupFunctionTests { ...@@ -58,14 +59,14 @@ public class PathResourceLookupFunctionTests {
@Test @Test
public void subPath() throws Exception { public void subPath() throws Exception {
ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/"); ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/server/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location);
MockServerRequest request = MockServerRequest.builder() MockServerRequest request = MockServerRequest.builder()
.uri(new URI("http://localhost/resources/child/response.txt")) .uri(new URI("http://localhost/resources/child/response.txt"))
.build(); .build();
Mono<Resource> result = function.apply(request); Mono<Resource> result = function.apply(request);
File expected = new ClassPathResource("org/springframework/web/reactive/function/child/response.txt").getFile(); File expected = new ClassPathResource("org/springframework/web/reactive/function/server/child/response.txt").getFile();
StepVerifier.create(result) StepVerifier.create(result)
.expectNextMatches(resource -> { .expectNextMatches(resource -> {
try { try {
...@@ -81,7 +82,7 @@ public class PathResourceLookupFunctionTests { ...@@ -81,7 +82,7 @@ public class PathResourceLookupFunctionTests {
@Test @Test
public void notFound() throws Exception { public void notFound() throws Exception {
ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/"); ClassPathResource location = new ClassPathResource("org/springframework/web/reactive/function/server/");
PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location); PathResourceLookupFunction function = new PathResourceLookupFunction("/resources/**", location);
MockServerRequest request = MockServerRequest.builder() MockServerRequest request = MockServerRequest.builder()
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
...@@ -34,9 +34,9 @@ import org.springframework.web.client.RestTemplate; ...@@ -34,9 +34,9 @@ import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.springframework.http.codec.BodyExtractors.toMono; import static org.springframework.http.codec.BodyExtractors.toMono;
import static org.springframework.http.codec.BodyInserters.fromPublisher; import static org.springframework.http.codec.BodyInserters.fromPublisher;
import static org.springframework.web.reactive.function.RequestPredicates.GET; import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.RequestPredicates.POST; import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
import static org.springframework.web.reactive.function.RouterFunctions.route; import static org.springframework.web.reactive.function.server.RouterFunctions.route;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import org.junit.Test; import org.junit.Test;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.net.URI; import java.net.URI;
import java.util.Collections; import java.util.Collections;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
...@@ -35,7 +35,9 @@ import org.springframework.web.server.ServerWebExchange; ...@@ -35,7 +35,9 @@ import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager; import org.springframework.web.server.session.MockWebSessionManager;
import static org.junit.Assert.*; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import org.junit.Test; import org.junit.Test;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -51,7 +51,8 @@ public class RouterFunctionsTests { ...@@ -51,7 +51,8 @@ public class RouterFunctionsTests {
RequestPredicate requestPredicate = mock(RequestPredicate.class); RequestPredicate requestPredicate = mock(RequestPredicate.class);
when(requestPredicate.test(request)).thenReturn(true); when(requestPredicate.test(request)).thenReturn(true);
RouterFunction<ServerResponse> result = RouterFunctions.route(requestPredicate, handlerFunction); RouterFunction<ServerResponse>
result = RouterFunctions.route(requestPredicate, handlerFunction);
assertNotNull(result); assertNotNull(result);
Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function; package org.springframework.web.reactive.function.server;
import java.time.Duration; import java.time.Duration;
...@@ -28,11 +28,11 @@ import org.springframework.http.MediaType; ...@@ -28,11 +28,11 @@ import org.springframework.http.MediaType;
import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.http.codec.BodyExtractors; import org.springframework.http.codec.BodyExtractors;
import org.springframework.http.codec.ServerSentEvent; import org.springframework.http.codec.ServerSentEvent;
import org.springframework.web.client.reactive.ClientRequest; import org.springframework.web.reactive.function.client.ClientRequest;
import org.springframework.web.client.reactive.WebClient; import org.springframework.web.reactive.function.client.WebClient;
import static org.springframework.http.codec.BodyInserters.fromServerSentEvents; import static org.springframework.http.codec.BodyInserters.fromServerSentEvents;
import static org.springframework.web.reactive.function.RouterFunctions.route; import static org.springframework.web.reactive.function.server.RouterFunctions.route;
/** /**
* @author Arjen Poutsma * @author Arjen Poutsma
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.reactive.function.support; package org.springframework.web.reactive.function.server.support;
import java.net.URI; import java.net.URI;
import java.util.Collections; import java.util.Collections;
...@@ -26,7 +26,7 @@ import org.junit.Before; ...@@ -26,7 +26,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.web.reactive.function.ServerRequest; import org.springframework.web.reactive.function.server.ServerRequest;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册