Move RxNetty support to test scope
The RxNetty runtime support is not meant to be officially supported and should be restricted to testing purposes only. Issue: SPR-15444
This commit is contained in:
12
build.gradle
12
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}")
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
* {@link org.springframework.http.server.reactive.HttpHandler} for processing.
|
||||
*
|
||||
* <p>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;
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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) {
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||
*
|
||||
* <p>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},</li>
|
||||
* <li>Reactor using the
|
||||
* {@link org.springframework.http.server.reactive.ReactorHttpHandlerAdapter},</li>
|
||||
* <li>RxNetty using the
|
||||
* {@link org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter}, or </li>
|
||||
* <li>Undertow using the
|
||||
* {@link org.springframework.http.server.reactive.UndertowHttpHandlerAdapter}.</li>
|
||||
* </ul>
|
||||
@@ -212,8 +210,6 @@ public abstract class RouterFunctions {
|
||||
* {@link org.springframework.http.server.reactive.ServletHttpHandlerAdapter},</li>
|
||||
* <li>Reactor using the
|
||||
* {@link org.springframework.http.server.reactive.ReactorHttpHandlerAdapter},</li>
|
||||
* <li>RxNetty using the
|
||||
* {@link org.springframework.http.server.reactive.RxNettyHttpHandlerAdapter}, or </li>
|
||||
* <li>Undertow using the
|
||||
* {@link org.springframework.http.server.reactive.UndertowHttpHandlerAdapter}.</li>
|
||||
* </ul>
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -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.
|
||||
*
|
||||
* <p><strong>Note: </strong> 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
|
||||
@@ -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
|
||||
@@ -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]
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user