Upgraded to AspectJ 1.8.1 (also declared as recommended user version) and Tomcat 8.0.9 (first stable version)
Issue: SPR-11957
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -23,8 +23,8 @@ import org.apache.catalina.Context;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.catalina.startup.Tomcat;
|
||||
import org.apache.coyote.http11.Http11NioProtocol;
|
||||
import org.apache.tomcat.util.descriptor.web.ApplicationListener;
|
||||
import org.apache.tomcat.websocket.server.WsContextListener;
|
||||
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
@@ -36,9 +36,6 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
*/
|
||||
public class TomcatWebSocketTestServer implements WebSocketTestServer {
|
||||
|
||||
private static final ApplicationListener WS_APPLICATION_LISTENER =
|
||||
new ApplicationListener(WsContextListener.class.getName(), false);
|
||||
|
||||
private final Tomcat tomcatServer;
|
||||
|
||||
private final int port;
|
||||
@@ -47,20 +44,19 @@ public class TomcatWebSocketTestServer implements WebSocketTestServer {
|
||||
|
||||
|
||||
public TomcatWebSocketTestServer() {
|
||||
|
||||
this.port = SocketUtils.findAvailableTcpPort();
|
||||
|
||||
Connector connector = new Connector(Http11NioProtocol.class.getName());
|
||||
connector.setPort(this.port);
|
||||
connector.setPort(this.port);
|
||||
|
||||
File baseDir = createTempDir("tomcat");
|
||||
String baseDirPath = baseDir.getAbsolutePath();
|
||||
File baseDir = createTempDir("tomcat");
|
||||
String baseDirPath = baseDir.getAbsolutePath();
|
||||
|
||||
this.tomcatServer = new Tomcat();
|
||||
this.tomcatServer.setBaseDir(baseDirPath);
|
||||
this.tomcatServer.setPort(this.port);
|
||||
this.tomcatServer.getService().addConnector(connector);
|
||||
this.tomcatServer.setConnector(connector);
|
||||
this.tomcatServer.getService().addConnector(connector);
|
||||
this.tomcatServer.setConnector(connector);
|
||||
}
|
||||
|
||||
private File createTempDir(String prefix) {
|
||||
@@ -83,9 +79,9 @@ public class TomcatWebSocketTestServer implements WebSocketTestServer {
|
||||
|
||||
@Override
|
||||
public void deployConfig(WebApplicationContext wac) {
|
||||
this.context = this.tomcatServer.addContext("", System.getProperty("java.io.tmpdir"));
|
||||
this.context.addApplicationListener(WS_APPLICATION_LISTENER);
|
||||
Tomcat.addServlet(context, "dispatcherServlet", new DispatcherServlet(wac));
|
||||
this.context = this.tomcatServer.addContext("", System.getProperty("java.io.tmpdir"));
|
||||
this.context.addApplicationListener(WsContextListener.class.getName());
|
||||
Tomcat.addServlet(this.context, "dispatcherServlet", new DispatcherServlet(wac));
|
||||
this.context.addServletMapping("/", "dispatcherServlet");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user