diff --git a/build.gradle b/build.gradle index f6152016a8..67ab61c30a 100644 --- a/build.gradle +++ b/build.gradle @@ -712,9 +712,6 @@ project("spring-web") { optional("org.reactivestreams:reactive-streams") optional("io.projectreactor:reactor-core") optional("io.projectreactor.ipc:reactor-netty") - optional("io.reactivex:rxnetty-http:${rxnettyVersion}") { - exclude group: 'io.reactivex', module: 'rxjava' - } optional("io.reactivex:rxjava:${rxjavaVersion}") optional("io.reactivex:rxjava-reactive-streams:${rxjavaAdapterVersion}") optional("io.reactivex.rxjava2:rxjava:${rxjava2Version}") @@ -766,6 +763,9 @@ project("spring-web") { testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}") testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}") testCompile("org.eclipse.jetty:jetty-servlet:${jettyVersion}") + testCompile("io.reactivex:rxnetty-http:${rxnettyVersion}") { + exclude group: 'io.reactivex', module: 'rxjava' + } testCompile("com.squareup.okhttp3:mockwebserver:${okhttp3Version}") testCompile("org.xmlunit:xmlunit-matchers:${xmlunitVersion}") testCompile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") @@ -800,9 +800,6 @@ project("spring-webflux") { } optional('org.webjars:webjars-locator:0.32-1') optional("io.projectreactor.ipc:reactor-netty") - optional("io.reactivex:rxnetty-http:${rxnettyVersion}") { - exclude group: 'io.reactivex', module: 'rxjava' - } optional("io.reactivex:rxjava:${rxjavaVersion}") optional("io.reactivex:rxjava-reactive-streams:${rxjavaAdapterVersion}") optional("javax.websocket:javax.websocket-api:${websocketVersion}") @@ -828,6 +825,9 @@ project("spring-webflux") { testCompile "io.reactivex.rxjava2:rxjava:${rxjava2Version}" testCompile("io.undertow:undertow-core:${undertowVersion}") testCompile("org.jboss.xnio:xnio-api:${xnioVersion}") + testCompile("io.reactivex:rxnetty-http:${rxnettyVersion}") { + exclude group: 'io.reactivex', module: 'rxjava' + } testCompile("com.fasterxml:aalto-xml:1.0.0") testCompile("org.xmlunit:xmlunit-matchers:${xmlunitVersion}") testCompile("com.squareup.okhttp3:mockwebserver:${okhttp3Version}") diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/package-info.java b/spring-web/src/main/java/org/springframework/http/server/reactive/package-info.java index 326ac71502..4c49c9e301 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/package-info.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/package-info.java @@ -5,6 +5,6 @@ * {@link org.springframework.http.server.reactive.HttpHandler} for processing. * *

Also provides implementations adapting to different runtimes - * including Servlet 3.1 containers, Netty + Reactor IO or RxNetty, and Undertow. + * including Servlet 3.1 containers, Netty + Reactor IO, and Undertow. */ package org.springframework.http.server.reactive; diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java similarity index 98% rename from spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java rename to spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java index 091c220a1c..ac9eb4ffa9 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java @@ -36,6 +36,7 @@ import rx.RxReactiveStreams; /** * Adapt {@link HttpHandler} to the RxNetty {@link RequestHandler}. + * For internal use within the framework. * * @author Rossen Stoyanchev * @since 5.0 diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java similarity index 98% rename from spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java rename to spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java index 28effa2f95..503c2653ad 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java @@ -39,6 +39,7 @@ import org.springframework.util.MultiValueMap; /** * Adapt {@link ServerHttpRequest} to the RxNetty {@link HttpServerRequest}. + * For internal use within the framework. * * @author Rossen Stoyanchev * @author Stephane Maldini diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java similarity index 99% rename from spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java rename to spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java index 71c9f33442..f25f1df618 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/RxNettyServerHttpResponse.java @@ -38,7 +38,8 @@ import org.springframework.util.Assert; /** * Adapt {@link ServerHttpResponse} to the RxNetty {@link HttpServerResponse}. - * + * For internal use within the framework. + * * @author Rossen Stoyanchev * @author Stephane Maldini * @author Sebastien Deleuze diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java index ea16fefc45..754125719b 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java @@ -183,7 +183,6 @@ public class DispatcherHandler implements WebHandler, ApplicationContextAware { * @see HttpWebHandlerAdapter * @see org.springframework.http.server.reactive.ServletHttpHandlerAdapter * @see org.springframework.http.server.reactive.ReactorHttpHandlerAdapter - * @see org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter * @see org.springframework.http.server.reactive.UndertowHttpHandlerAdapter */ public static HttpHandler toHttpHandler(ApplicationContext context) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java index 60e15438e8..a09e8061f4 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java @@ -46,7 +46,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder; * *

Additionally, this class can {@linkplain #toHttpHandler(RouterFunction) transform} a * {@code RouterFunction} into an {@code HttpHandler}, which can be run in Servlet 3.1+, - * Reactor, RxNetty, or Undertow. + * Reactor, or Undertow. * And it can {@linkplain #toHandlerMapping(RouterFunction, HandlerStrategies) transform} a * {@code RouterFunction} into an {@code HandlerMapping}, which can be run in a * {@code DispatcherHandler}. @@ -188,8 +188,6 @@ public abstract class RouterFunctions { * {@link org.springframework.http.server.reactive.ServletHttpHandlerAdapter}, *

  • Reactor using the * {@link org.springframework.http.server.reactive.ReactorHttpHandlerAdapter},
  • - *
  • RxNetty using the - * {@link org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter}, or
  • *
  • Undertow using the * {@link org.springframework.http.server.reactive.UndertowHttpHandlerAdapter}.
  • * @@ -212,8 +210,6 @@ public abstract class RouterFunctions { * {@link org.springframework.http.server.reactive.ServletHttpHandlerAdapter}, *
  • Reactor using the * {@link org.springframework.http.server.reactive.ReactorHttpHandlerAdapter},
  • - *
  • RxNetty using the - * {@link org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter}, or
  • *
  • Undertow using the * {@link org.springframework.http.server.reactive.UndertowHttpHandlerAdapter}.
  • * diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java index 614a1f9842..d9cda67fcd 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java @@ -67,10 +67,6 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle { "reactor.ipc.netty.http.server.HttpServerResponse", HandshakeWebSocketService.class.getClassLoader()); - private static final boolean rxNettyPresent = ClassUtils.isPresent( - "io.reactivex.netty.protocol.http.server.HttpServerResponse", - HandshakeWebSocketService.class.getClassLoader()); - private static final boolean undertowPresent = ClassUtils.isPresent( "io.undertow.websockets.WebSocketProtocolHandshakeHandler", HandshakeWebSocketService.class.getClassLoader()); @@ -112,9 +108,6 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle { else if (reactorNettyPresent) { className = "ReactorNettyRequestUpgradeStrategy"; } - else if (rxNettyPresent) { - className = "RxNettyRequestUpgradeStrategy"; - } else if (undertowPresent) { className = "UndertowRequestUpgradeStrategy"; } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java similarity index 98% rename from spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java rename to spring-webflux/src/test/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java index 53d6477a83..e9cfd05a2f 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/adapter/RxNettyWebSocketSession.java @@ -39,7 +39,8 @@ import org.springframework.web.reactive.socket.WebSocketSession; /** * Spring {@link WebSocketSession} implementation that adapts to the RxNetty * {@link io.reactivex.netty.protocol.http.ws.WebSocketConnection}. - * + * For internal use within the framework. + * * @author Rossen Stoyanchev * @since 5.0 */ diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java similarity index 98% rename from spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java rename to spring-webflux/src/test/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java index a98b55e088..b5932914b6 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/client/RxNettyWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 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. @@ -47,7 +47,8 @@ import static io.reactivex.netty.protocol.http.HttpHandlerNames.WsClientDecoder; /** * {@link WebSocketClient} implementation for use with RxNetty. - * + * For internal use within the framework. + * *

    Note: RxNetty {@link HttpClient} instances require a host * and port in order to be created. Hence it is not possible to configure a * single {@code HttpClient} instance to use upfront. Instead the constructors diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java similarity index 97% rename from spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java rename to spring-webflux/src/test/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java index f626446760..64323b1540 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/server/upgrade/RxNettyRequestUpgradeStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 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. @@ -35,6 +35,7 @@ import org.springframework.web.server.ServerWebExchange; /** * A {@link RequestUpgradeStrategy} for use with RxNetty. + * For internal use within the framework. * * @author Rossen Stoyanchev * @since 5.0 diff --git a/src/docs/asciidoc/web/web-flux-functional.adoc b/src/docs/asciidoc/web/web-flux-functional.adoc index 1fb7dca48d..3b1cb90d72 100644 --- a/src/docs/asciidoc/web/web-flux-functional.adoc +++ b/src/docs/asciidoc/web/web-flux-functional.adoc @@ -177,7 +177,7 @@ Now there is just one piece of the puzzle missing: running a router function in You can convert a router function into a `HttpHandler` by using `RouterFunctions.toHttpHandler(RouterFunction)`. The `HttpHandler` allows you to run on a wide variety of reactive runtimes: Reactor Netty, -RxNetty, Servlet 3.1+, and Undertow. +Servlet 3.1+, and Undertow. Here is how we run a router function in Reactor Netty, for instance: [source,java,indent=0] diff --git a/src/docs/asciidoc/web/web-flux.adoc b/src/docs/asciidoc/web/web-flux.adoc index 9c76786cf7..484d7d6118 100644 --- a/src/docs/asciidoc/web/web-flux.adoc +++ b/src/docs/asciidoc/web/web-flux.adoc @@ -223,7 +223,7 @@ default as following: WebFlux includes reactive WebSocket client and server support. Both client and server are supported on the Java WebSocket API -(JSR-356), Jetty, Undertow, Reactor Netty, and RxNetty. +(JSR-356), Jetty, Undertow, and Reactor Netty. On the server side, declare a `WebSocketHandlerAdapter` and then simply add mappings to `WebSocketHandler`-based endpoints: @@ -310,7 +310,6 @@ Lastly add the dependencies for one of the supported runtimes: * Tomcat -- `org.apache.tomcat.embed:tomcat-embed-core` * Jetty -- `org.eclipse.jetty:jetty-server` and `org.eclipse.jetty:jetty-servlet` * Reactor Netty -- `io.projectreactor.ipc:reactor-netty` -* RxNetty -- `io.reactivex:rxnetty-common` and `io.reactivex:rxnetty-http` * Undertow -- `io.undertow:undertow-core` For the **annotation-based programming model** bootstrap with: @@ -356,11 +355,6 @@ HttpServlet servlet = new ServletHttpHandlerAdapter(handler); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer.create(host, port).newHandler(adapter).block(); -// RxNetty -RxNettyHttpHandlerAdapter adapter = new RxNettyHttpHandlerAdapter(handler); -HttpServer server = HttpServer.newServer(new InetSocketAddress(host, port)); -server.startAndAwait(adapter); - // Undertow UndertowHttpHandlerAdapter adapter = new UndertowHttpHandlerAdapter(handler); Undertow server = Undertow.builder().addHttpListener(port, host).setHandler(adapter).build();