Move ~.web.reactive.server to ~.http.server
This commit is contained in:
@@ -14,21 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import org.springframework.web.reactive.HttpServer;
|
||||
import org.springframework.web.reactive.ReactorHttpServer;
|
||||
import org.springframework.web.reactive.RxNettyHttpServer;
|
||||
import org.springframework.web.reactive.JettyHttpServer;
|
||||
import org.springframework.web.reactive.TomcatHttpServer;
|
||||
import org.springframework.web.reactive.UndertowHttpServer;
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@@ -61,7 +54,7 @@ public abstract class AbstractHttpHandlerIntegrationTests {
|
||||
this.server.start();
|
||||
}
|
||||
|
||||
protected abstract HttpHandler createHttpHandler();
|
||||
protected abstract ReactiveHttpHandler createHttpHandler();
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
@@ -14,18 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.http.server.ReactiveServerHttpRequest;
|
||||
import org.springframework.http.server.ReactiveServerHttpResponse;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
import org.springframework.http.server.ReactiveHttpHandler;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class EchoHandler implements HttpHandler {
|
||||
public class EchoHandler implements ReactiveHttpHandler {
|
||||
|
||||
@Override
|
||||
public Publisher<Void> handle(ReactiveServerHttpRequest request, ReactiveServerHttpResponse response) {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
@@ -24,7 +24,6 @@ import org.junit.Test;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.reactive.AbstractHttpHandlerIntegrationTests;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
import org.springframework.http.server.ReactiveHttpHandler;
|
||||
|
||||
/**
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -28,6 +28,6 @@ public interface HttpServer extends InitializingBean, Lifecycle {
|
||||
|
||||
void setPort(int port);
|
||||
|
||||
void setHandler(HttpHandler handler);
|
||||
void setHandler(ReactiveHttpHandler handler);
|
||||
|
||||
}
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
import org.springframework.http.server.ReactiveHttpHandler;
|
||||
|
||||
/**
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -26,7 +26,7 @@ public class HttpServerSupport {
|
||||
|
||||
private int port = -1;
|
||||
|
||||
private HttpHandler httpHandler;
|
||||
private ReactiveHttpHandler httpHandler;
|
||||
|
||||
|
||||
public void setPort(int port) {
|
||||
@@ -37,11 +37,11 @@ public class HttpServerSupport {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void setHandler(HttpHandler handler) {
|
||||
public void setHandler(ReactiveHttpHandler handler) {
|
||||
this.httpHandler = handler;
|
||||
}
|
||||
|
||||
public HttpHandler getHttpHandler() {
|
||||
public ReactiveHttpHandler getHttpHandler() {
|
||||
return this.httpHandler;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
@@ -24,7 +24,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.reactive.server.servlet.HttpHandlerServlet;
|
||||
import org.springframework.http.server.servlet31.Servlet31HttpHandlerAdapter;
|
||||
|
||||
/**
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -51,7 +51,7 @@ public class JettyHttpServer extends HttpServerSupport implements InitializingBe
|
||||
this.jettyServer = new Server();
|
||||
|
||||
Assert.notNull(getHttpHandler());
|
||||
HttpHandlerServlet servlet = new HttpHandlerServlet();
|
||||
Servlet31HttpHandlerAdapter servlet = new Servlet31HttpHandlerAdapter();
|
||||
servlet.setHandler(getHttpHandler());
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Random;
|
||||
@@ -27,16 +27,12 @@ import org.reactivestreams.Subscription;
|
||||
import reactor.io.buffer.Buffer;
|
||||
import reactor.rx.Streams;
|
||||
|
||||
import org.springframework.http.server.ReactiveServerHttpRequest;
|
||||
import org.springframework.http.server.ReactiveServerHttpResponse;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class RandomHandler implements HttpHandler {
|
||||
public class RandomHandler implements ReactiveHttpHandler {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(RandomHandler.class);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
@@ -24,7 +24,6 @@ import org.junit.Test;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.reactive.AbstractHttpHandlerIntegrationTests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import reactor.io.buffer.Buffer;
|
||||
import reactor.io.net.ReactiveNet;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.reactive.server.reactor.RequestHandlerAdapter;
|
||||
import org.springframework.http.server.reactor.ReactorHttpHandlerAdapter;
|
||||
|
||||
/**
|
||||
* @author Stephane Maldini
|
||||
@@ -29,7 +29,7 @@ import org.springframework.web.reactive.server.reactor.RequestHandlerAdapter;
|
||||
public class ReactorHttpServer extends HttpServerSupport
|
||||
implements InitializingBean, HttpServer {
|
||||
|
||||
private RequestHandlerAdapter reactorHandler;
|
||||
private ReactorHttpHandlerAdapter reactorHandler;
|
||||
|
||||
private reactor.io.net.http.HttpServer<Buffer, Buffer> reactorServer;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ReactorHttpServer extends HttpServerSupport
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.notNull(getHttpHandler());
|
||||
this.reactorHandler = new RequestHandlerAdapter(getHttpHandler());
|
||||
this.reactorHandler = new ReactorHttpHandlerAdapter(getHttpHandler());
|
||||
|
||||
this.reactorServer = (getPort() != -1 ? ReactiveNet.httpServer(getPort()) :
|
||||
ReactiveNet.httpServer());
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.reactive.server.rxnetty.RequestHandlerAdapter;
|
||||
import org.springframework.http.server.rxnetty.RxNettyHttpHandlerAdapter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ import org.springframework.web.reactive.server.rxnetty.RequestHandlerAdapter;
|
||||
*/
|
||||
public class RxNettyHttpServer extends HttpServerSupport implements InitializingBean, HttpServer {
|
||||
|
||||
private RequestHandlerAdapter rxNettyHandler;
|
||||
private RxNettyHttpHandlerAdapter rxNettyHandler;
|
||||
|
||||
private io.reactivex.netty.protocol.http.server.HttpServer<ByteBuf, ByteBuf> rxNettyServer;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RxNettyHttpServer extends HttpServerSupport implements Initializing
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.notNull(getHttpHandler());
|
||||
this.rxNettyHandler = new RequestHandlerAdapter(getHttpHandler());
|
||||
this.rxNettyHandler = new RxNettyHttpHandlerAdapter(getHttpHandler());
|
||||
|
||||
this.rxNettyServer = (getPort() != -1 ?
|
||||
io.reactivex.netty.protocol.http.server.HttpServer.newServer(getPort()) :
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.apache.catalina.startup.Tomcat;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.reactive.server.servlet.HttpHandlerServlet;
|
||||
import org.springframework.http.server.servlet31.Servlet31HttpHandlerAdapter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class TomcatHttpServer extends HttpServerSupport implements InitializingB
|
||||
this.tomcatServer.setPort(getPort());
|
||||
|
||||
Assert.notNull(getHttpHandler());
|
||||
HttpHandlerServlet servlet = new HttpHandlerServlet();
|
||||
Servlet31HttpHandlerAdapter servlet = new Servlet31HttpHandlerAdapter();
|
||||
servlet.setHandler(getHttpHandler());
|
||||
|
||||
File base = new File(System.getProperty("java.io.tmpdir"));
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.reactive.server.undertow.UndertowHttpHandlerAdapter;
|
||||
import org.springframework.http.server.undertow.UndertowHttpHandlerAdapter;
|
||||
|
||||
import io.undertow.Undertow;
|
||||
import io.undertow.server.HttpHandler;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Marshaller;
|
||||
@@ -27,18 +27,15 @@ import reactor.io.buffer.Buffer;
|
||||
import reactor.rx.Streams;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.server.ReactiveServerHttpRequest;
|
||||
import org.springframework.http.server.ReactiveServerHttpResponse;
|
||||
import org.springframework.reactive.io.BufferOutputStream;
|
||||
import org.springframework.reactive.io.ByteBufferPublisherInputStream;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class XmlHandler implements HttpHandler {
|
||||
public class XmlHandler implements ReactiveHttpHandler {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(XmlHandler.class);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.handler;
|
||||
package org.springframework.http.server;
|
||||
|
||||
import java.net.URI;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
@@ -24,8 +24,6 @@ import org.junit.Test;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.reactive.AbstractHttpHandlerIntegrationTests;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -33,7 +31,7 @@ import org.springframework.web.reactive.HttpHandler;
|
||||
public class XmlHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
|
||||
@Override
|
||||
protected HttpHandler createHttpHandler() {
|
||||
protected ReactiveHttpHandler createHttpHandler() {
|
||||
return new XmlHandler();
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.reactive.server.servlet;
|
||||
package org.springframework.http.server.servlet31;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.web.reactive.server.servlet.AsyncContextSynchronizer;
|
||||
import org.springframework.http.server.servlet31.AsyncContextSynchronizer;
|
||||
|
||||
import static org.mockito.BDDMockito.mock;
|
||||
import static org.mockito.BDDMockito.verify;
|
||||
@@ -32,8 +32,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.server.ReactiveServerHttpRequest;
|
||||
import org.springframework.http.server.ReactiveServerHttpResponse;
|
||||
import org.springframework.web.reactive.DispatcherHandler;
|
||||
import org.springframework.web.reactive.AbstractHttpHandlerIntegrationTests;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
import org.springframework.http.server.AbstractHttpHandlerIntegrationTests;
|
||||
import org.springframework.http.server.ReactiveHttpHandler;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
|
||||
|
||||
|
||||
@Override
|
||||
protected HttpHandler createHttpHandler() {
|
||||
protected ReactiveHttpHandler createHttpHandler() {
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.registerSingleton("hm", TestHandlerMapping.class);
|
||||
@@ -100,7 +100,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
|
||||
}
|
||||
}
|
||||
|
||||
private static class FooHandler implements HttpHandler {
|
||||
private static class FooHandler implements ReactiveHttpHandler {
|
||||
|
||||
@Override
|
||||
public Publisher<Void> handle(ReactiveServerHttpRequest request, ReactiveServerHttpResponse response) {
|
||||
@@ -108,7 +108,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
|
||||
}
|
||||
}
|
||||
|
||||
private static class BarHandler implements HttpHandler {
|
||||
private static class BarHandler implements ReactiveHttpHandler {
|
||||
|
||||
@Override
|
||||
public Publisher<Void> handle(ReactiveServerHttpRequest request, ReactiveServerHttpResponse response) {
|
||||
|
||||
@@ -53,8 +53,8 @@ import org.springframework.reactive.codec.encoder.JsonObjectEncoder;
|
||||
import org.springframework.reactive.codec.encoder.StringEncoder;
|
||||
import org.springframework.web.reactive.DispatcherHandler;
|
||||
import org.springframework.web.reactive.handler.SimpleHandlerResultHandler;
|
||||
import org.springframework.web.reactive.AbstractHttpHandlerIntegrationTests;
|
||||
import org.springframework.web.reactive.HttpHandler;
|
||||
import org.springframework.http.server.AbstractHttpHandlerIntegrationTests;
|
||||
import org.springframework.http.server.ReactiveHttpHandler;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -76,7 +76,7 @@ public class RequestMappingIntegrationTests extends AbstractHttpHandlerIntegrati
|
||||
|
||||
|
||||
@Override
|
||||
protected HttpHandler createHttpHandler() {
|
||||
protected ReactiveHttpHandler createHttpHandler() {
|
||||
this.wac = new AnnotationConfigWebApplicationContext();
|
||||
this.wac.register(FrameworkConfig.class, ApplicationConfig.class);
|
||||
this.wac.refresh();
|
||||
|
||||
Reference in New Issue
Block a user