Use separate reactive HttpHandler for Tomcat/Jetty

Introduce separate adapters TomcatHttpHandlerAdapter/JettyHttpHandlerAdapter
so that each adapter can use the Tomcat/Jetty APIs for reading/writing
with ByteBuffer.
This commit is contained in:
Violeta Georgieva
2017-01-24 20:41:26 +02:00
committed by Rossen Stoyanchev
parent ea67a637ae
commit 383375c35f
8 changed files with 264 additions and 45 deletions

View File

@@ -22,6 +22,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.http.server.reactive.JettyHttpHandlerAdapter;
import org.springframework.http.server.reactive.ServletHttpHandlerAdapter;
import org.springframework.util.Assert;
@@ -56,11 +57,11 @@ public class JettyHttpServer extends HttpServerSupport implements HttpServer, In
private ServletHttpHandlerAdapter initServletHttpHandlerAdapter() {
if (getHttpHandlerMap() != null) {
return new ServletHttpHandlerAdapter(getHttpHandlerMap());
return new JettyHttpHandlerAdapter(getHttpHandlerMap());
}
else {
Assert.notNull(getHttpHandler());
return new ServletHttpHandlerAdapter(getHttpHandler());
return new JettyHttpHandlerAdapter(getHttpHandler());
}
}

View File

@@ -24,6 +24,7 @@ import org.apache.catalina.startup.Tomcat;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.http.server.reactive.ServletHttpHandlerAdapter;
import org.springframework.http.server.reactive.TomcatHttpHandlerAdapter;
import org.springframework.util.Assert;
/**
@@ -75,11 +76,11 @@ public class TomcatHttpServer extends HttpServerSupport implements HttpServer, I
private ServletHttpHandlerAdapter initServletHttpHandlerAdapter() {
if (getHttpHandlerMap() != null) {
return new ServletHttpHandlerAdapter(getHttpHandlerMap());
return new TomcatHttpHandlerAdapter(getHttpHandlerMap());
}
else {
Assert.notNull(getHttpHandler());
return new ServletHttpHandlerAdapter(getHttpHandler());
return new TomcatHttpHandlerAdapter(getHttpHandler());
}
}