|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -16,6 +16,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.web.socket; |
|
|
|
package org.springframework.web.socket; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import javax.servlet.DispatcherType; |
|
|
|
|
|
|
|
import javax.servlet.Filter; |
|
|
|
|
|
|
|
import javax.servlet.Servlet; |
|
|
|
|
|
|
|
import javax.servlet.ServletContext; |
|
|
|
|
|
|
|
import javax.servlet.ServletException; |
|
|
|
|
|
|
|
|
|
|
|
import io.undertow.Undertow; |
|
|
|
import io.undertow.Undertow; |
|
|
|
import io.undertow.server.HttpHandler; |
|
|
|
import io.undertow.server.HttpHandler; |
|
|
|
import io.undertow.servlet.api.DeploymentInfo; |
|
|
|
import io.undertow.servlet.api.DeploymentInfo; |
|
|
|
@ -24,23 +31,14 @@ import io.undertow.servlet.api.FilterInfo; |
|
|
|
import io.undertow.servlet.api.InstanceFactory; |
|
|
|
import io.undertow.servlet.api.InstanceFactory; |
|
|
|
import io.undertow.servlet.api.InstanceHandle; |
|
|
|
import io.undertow.servlet.api.InstanceHandle; |
|
|
|
import io.undertow.websockets.jsr.WebSocketDeploymentInfo; |
|
|
|
import io.undertow.websockets.jsr.WebSocketDeploymentInfo; |
|
|
|
|
|
|
|
import org.xnio.OptionMap; |
|
|
|
import java.io.IOException; |
|
|
|
import org.xnio.Xnio; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.DispatcherType; |
|
|
|
|
|
|
|
import javax.servlet.Filter; |
|
|
|
|
|
|
|
import javax.servlet.Servlet; |
|
|
|
|
|
|
|
import javax.servlet.ServletContext; |
|
|
|
|
|
|
|
import javax.servlet.ServletException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.SocketUtils; |
|
|
|
import org.springframework.util.SocketUtils; |
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
import org.springframework.web.servlet.DispatcherServlet; |
|
|
|
import org.springframework.web.servlet.DispatcherServlet; |
|
|
|
|
|
|
|
|
|
|
|
import org.xnio.OptionMap; |
|
|
|
|
|
|
|
import org.xnio.Xnio; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static io.undertow.servlet.Servlets.*; |
|
|
|
import static io.undertow.servlet.Servlets.*; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -63,11 +61,6 @@ public class UndertowTestServer implements WebSocketTestServer { |
|
|
|
this.port = SocketUtils.findAvailableTcpPort(); |
|
|
|
this.port = SocketUtils.findAvailableTcpPort(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int getPort() { |
|
|
|
|
|
|
|
return this.port; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
public void deployConfig(WebApplicationContext wac, Filter... filters) { |
|
|
|
public void deployConfig(WebApplicationContext wac, Filter... filters) { |
|
|
|
@ -108,11 +101,6 @@ public class UndertowTestServer implements WebSocketTestServer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ServletContext getServletContext() { |
|
|
|
|
|
|
|
return this.manager.getDeployment().getServletContext(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void undeployConfig() { |
|
|
|
public void undeployConfig() { |
|
|
|
this.manager.undeploy(); |
|
|
|
this.manager.undeploy(); |
|
|
|
@ -128,6 +116,16 @@ public class UndertowTestServer implements WebSocketTestServer { |
|
|
|
this.server.stop(); |
|
|
|
this.server.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int getPort() { |
|
|
|
|
|
|
|
return this.port; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ServletContext getServletContext() { |
|
|
|
|
|
|
|
return this.manager.getDeployment().getServletContext(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class DispatcherServletInstanceFactory implements InstanceFactory<Servlet> { |
|
|
|
private static class DispatcherServletInstanceFactory implements InstanceFactory<Servlet> { |
|
|
|
|
|
|
|
|
|
|
|
@ -151,6 +149,7 @@ public class UndertowTestServer implements WebSocketTestServer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class FilterInstanceFactory implements InstanceFactory<Filter> { |
|
|
|
private static class FilterInstanceFactory implements InstanceFactory<Filter> { |
|
|
|
|
|
|
|
|
|
|
|
private final Filter filter; |
|
|
|
private final Filter filter; |
|
|
|
|