Initial reactive, WebSocket Tomcat support

Issue: SPR-14527
This commit is contained in:
Violeta Georgieva
2016-12-08 18:40:40 +02:00
committed by Rossen Stoyanchev
parent 41ece612cf
commit 46b39f4372
7 changed files with 649 additions and 1 deletions

View File

@@ -37,6 +37,8 @@ public class TomcatHttpServer extends HttpServerSupport implements HttpServer, I
private String baseDir;
private Class<?> wsListener;
public TomcatHttpServer() {
}
@@ -45,6 +47,11 @@ public class TomcatHttpServer extends HttpServerSupport implements HttpServer, I
this.baseDir = baseDir;
}
public TomcatHttpServer(String baseDir, Class<?> wsListener) {
this.baseDir = baseDir;
this.wsListener = wsListener;
}
@Override
public void afterPropertiesSet() throws Exception {
@@ -61,6 +68,9 @@ public class TomcatHttpServer extends HttpServerSupport implements HttpServer, I
Context rootContext = tomcatServer.addContext("", base.getAbsolutePath());
Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet);
rootContext.addServletMappingDecoded("/", "httpHandlerServlet");
if (wsListener != null) {
rootContext.addApplicationListener(wsListener.getName());
}
}
private ServletHttpHandlerAdapter initServletHttpHandlerAdapter() {