Author: markt
Date: Wed Mar 6 14:45:24 2013
New Revision: 1453350
URL: http://svn.apache.org/r1453350
Log:
Refactoring towards v014 API (not yet complete)
Added:
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfig.java
- copied, changed from r1452873,
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfiguration.java
tomcat/trunk/java/javax/websocket/server/ServerApplicationConfig.java
- copied, changed from r1452204,
tomcat/trunk/java/javax/websocket/server/ServerApplicationConfiguration.java
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfig.java
- copied, changed from r1452824,
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfiguration.java
Removed:
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfiguration.java
tomcat/trunk/java/javax/websocket/server/ServerApplicationConfiguration.java
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfiguration.java
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfigurationBuilder.java
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfigurator.java
Modified:
tomcat/trunk/java/javax/websocket/ContainerProvider.java
tomcat/trunk/java/javax/websocket/server/ServerEndpoint.java
tomcat/trunk/java/org/apache/tomcat/websocket/WsContainerProvider.java
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpoint.java
tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java
tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
Modified: tomcat/trunk/java/javax/websocket/ContainerProvider.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/ContainerProvider.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/ContainerProvider.java (original)
+++ tomcat/trunk/java/javax/websocket/ContainerProvider.java Wed Mar 6
14:45:24 2013
@@ -38,7 +38,7 @@ public abstract class ContainerProvider
ServiceLoader.load(ContainerProvider.class);
Iterator<ContainerProvider> iter = serviceLoader.iterator();
while (result == null && iter.hasNext()) {
- result = iter.next().getContainer(WebSocketContainer.class);
+ result = iter.next().getContainer();
}
// Fall-back. Also used by unit tests
@@ -56,5 +56,5 @@ public abstract class ContainerProvider
return result;
}
- protected abstract <T> T getContainer(Class<T> containerClass);
+ protected abstract WebSocketContainer getContainer();
}
Copied:
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfig.java (from
r1452873,
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfiguration.java)
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfig.java?p2=tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfig.java&p1=tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfiguration.java&r1=1452873&r2=1453350&rev=1453350&view=diff
==============================================================================
---
tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfiguration.java
(original)
+++ tomcat/trunk/java/javax/websocket/server/DefaultServerEndpointConfig.java
Wed Mar 6 14:45:24 2013
@@ -27,8 +27,7 @@ import javax.websocket.Extension;
/**
* Provides the default configuration for WebSocket server endpoints.
*/
-public class DefaultServerEndpointConfiguration
- implements ServerEndpointConfiguration {
+final class DefaultServerEndpointConfig implements ServerEndpointConfig {
private final Class<?> endpointClass;
private final String path;
@@ -36,15 +35,15 @@ public class DefaultServerEndpointConfig
private final List<Extension> extensions;
private final List<Class<? extends Encoder>> encoders;
private final List<Class<? extends Decoder>> decoders;
- private final ServerEndpointConfigurator serverEndpointConfigurator;
+ private final Configurator serverEndpointConfigurator;
private final Map<String,Object> userProperties = new HashMap<>();
- DefaultServerEndpointConfiguration(
+ DefaultServerEndpointConfig(
Class<?> endpointClass, String path,
List<String> subprotocols, List<Extension> extensions,
List<Class<? extends Encoder>> encoders,
List<Class<? extends Decoder>> decoders,
- ServerEndpointConfigurator serverEndpointConfigurator) {
+ Configurator serverEndpointConfigurator) {
this.endpointClass = endpointClass;
this.path = path;
this.subprotocols = subprotocols;
@@ -75,7 +74,7 @@ public class DefaultServerEndpointConfig
}
@Override
- public ServerEndpointConfigurator getServerEndpointConfigurator() {
+ public Configurator getConfigurator() {
return serverEndpointConfigurator;
}
@@ -85,12 +84,12 @@ public class DefaultServerEndpointConfig
}
@Override
- public List<String> getSubprotocols() {
+ public final List<String> getSubprotocols() {
return subprotocols;
}
@Override
- public List<Extension> getExtensions() {
+ public final List<Extension> getExtensions() {
return extensions;
}
}
Copied: tomcat/trunk/java/javax/websocket/server/ServerApplicationConfig.java
(from r1452204,
tomcat/trunk/java/javax/websocket/server/ServerApplicationConfiguration.java)
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/server/ServerApplicationConfig.java?p2=tomcat/trunk/java/javax/websocket/server/ServerApplicationConfig.java&p1=tomcat/trunk/java/javax/websocket/server/ServerApplicationConfiguration.java&r1=1452204&r2=1453350&rev=1453350&view=diff
==============================================================================
---
tomcat/trunk/java/javax/websocket/server/ServerApplicationConfiguration.java
(original)
+++ tomcat/trunk/java/javax/websocket/server/ServerApplicationConfig.java Wed
Mar 6 14:45:24 2013
@@ -20,9 +20,9 @@ import java.util.Set;
import javax.websocket.Endpoint;
-public interface ServerApplicationConfiguration {
+public interface ServerApplicationConfig {
- Set<Class<? extends ServerEndpointConfiguration>> getEndpointConfiguration(
+ Set<Class<? extends ServerEndpointConfig>> getEndpointConfiguration(
Set<Class<? extends Endpoint>> scanned);
Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned);
Modified: tomcat/trunk/java/javax/websocket/server/ServerEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/server/ServerEndpoint.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/server/ServerEndpoint.java (original)
+++ tomcat/trunk/java/javax/websocket/server/ServerEndpoint.java Wed Mar 6
14:45:24 2013
@@ -39,6 +39,6 @@ public @interface ServerEndpoint {
Class<? extends Encoder>[] encoders() default {};
- public Class<? extends ServerEndpointConfigurator> configurator()
- default ServerEndpointConfigurator.class;
+ public Class<? extends ServerEndpointConfig.Configurator> configurator()
+ default ServerEndpointConfig.Configurator.class;
}
Copied: tomcat/trunk/java/javax/websocket/server/ServerEndpointConfig.java
(from r1452824,
tomcat/trunk/java/javax/websocket/server/ServerEndpointConfiguration.java)
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/server/ServerEndpointConfig.java?p2=tomcat/trunk/java/javax/websocket/server/ServerEndpointConfig.java&p1=tomcat/trunk/java/javax/websocket/server/ServerEndpointConfiguration.java&r1=1452824&r2=1453350&rev=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/server/ServerEndpointConfiguration.java
(original)
+++ tomcat/trunk/java/javax/websocket/server/ServerEndpointConfig.java Wed Mar
6 14:45:24 2013
@@ -16,29 +16,198 @@
*/
package javax.websocket.server;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import javax.websocket.Decoder;
+import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
import javax.websocket.Extension;
+import javax.websocket.HandshakeResponse;
/**
* Provides configuration information for WebSocket endpoints published to a
* server. Applications may provide their own implementation or use
- * {@link ServerEndpointConfigurationBuilder}.
+ * {@link Builder}.
*/
-public interface ServerEndpointConfiguration extends EndpointConfig {
+public interface ServerEndpointConfig extends EndpointConfig {
Class<?> getEndpointClass();
- List<String> getSubprotocols();
-
- List<Extension> getExtensions();
-
/**
* Returns the path at which this WebSocket server endpoint has been
* registered. It may be a path or a level 0 URI template.
*/
String getPath();
- ServerEndpointConfigurator getServerEndpointConfigurator();
+ List<String> getSubprotocols();
+
+ List<Extension> getExtensions();
+
+ Configurator getConfigurator();
+
+
+ public final class Builder {
+
+ public static Builder create(
+ Class<?> endpointClass, String path) {
+ return new Builder(endpointClass, path);
+ }
+
+
+ private final Class<?> endpointClass;
+ private final String path;
+ private List<Class<? extends Encoder>> encoders =
Collections.EMPTY_LIST;
+ private List<Class<? extends Decoder>> decoders =
Collections.EMPTY_LIST;
+ private List<String> subprotocols = Collections.EMPTY_LIST;
+ private List<Extension> extensions = Collections.EMPTY_LIST;
+ private Configurator configurator =
+ Configurator.fetchContainerDefaultConfigurator();
+
+
+ private Builder(Class<?> endpointClass,
+ String path) {
+ this.endpointClass = endpointClass;
+ this.path = path;
+ }
+
+ public ServerEndpointConfig build() {
+ return new DefaultServerEndpointConfig(endpointClass, path,
+ subprotocols, extensions, encoders, decoders,
configurator);
+ }
+
+
+ public Builder encoders(
+ List<Class<? extends Encoder>> encoders) {
+ if (encoders == null || encoders.size() == 0) {
+ this.encoders = Collections.EMPTY_LIST;
+ } else {
+ this.encoders = Collections.unmodifiableList(encoders);
+ }
+ return this;
+ }
+
+
+ public Builder decoders(
+ List<Class<? extends Decoder>> decoders) {
+ if (decoders == null || decoders.size() == 0) {
+ this.decoders = Collections.EMPTY_LIST;
+ } else {
+ this.decoders = Collections.unmodifiableList(decoders);
+ }
+ return this;
+ }
+
+
+ public Builder subprotocols(
+ List<String> subprotocols) {
+ if (subprotocols == null || subprotocols.size() == 0) {
+ this.subprotocols = Collections.EMPTY_LIST;
+ } else {
+ this.subprotocols = Collections.unmodifiableList(subprotocols);
+ }
+ return this;
+ }
+
+
+ public Builder extensions(
+ List<Extension> extensions) {
+ if (extensions == null || extensions.size() == 0) {
+ this.extensions = Collections.EMPTY_LIST;
+ } else {
+ this.extensions = Collections.unmodifiableList(extensions);
+ }
+ return this;
+ }
+
+
+ public Builder configurator(Configurator serverEndpointConfigurator) {
+ if (serverEndpointConfigurator == null) {
+ this.configurator =
Configurator.fetchContainerDefaultConfigurator();
+ } else {
+ this.configurator = serverEndpointConfigurator;
+ }
+ return this;
+ }
+ }
+
+
+ public abstract class Configurator {
+
+ private static volatile Configurator defaultImpl = null;
+ private static final Object defaultImplLock = new Object();
+
+ private static final String DEFAULT_IMPL_CLASSNAME =
+
"org.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator";
+
+ static Configurator fetchContainerDefaultConfigurator() {
+ if (defaultImpl == null) {
+ synchronized (defaultImplLock) {
+ if (defaultImpl == null) {
+ defaultImpl = loadDefault();
+ }
+ }
+ }
+ return defaultImpl;
+ }
+
+
+ private static Configurator loadDefault() {
+ Configurator result = null;
+
+ ServiceLoader<Configurator> serviceLoader =
+ ServiceLoader.load(Configurator.class);
+
+ Iterator<Configurator> iter = serviceLoader.iterator();
+ while (result == null && iter.hasNext()) {
+ result = iter.next();
+ }
+
+ // Fall-back. Also used by unit tests
+ if (result == null) {
+ try {
+ Class<Configurator> clazz =
+ (Class<Configurator>) Class.forName(
+ DEFAULT_IMPL_CLASSNAME);
+ result = clazz.newInstance();
+ } catch (ClassNotFoundException | InstantiationException |
+ IllegalAccessException e) {
+ // No options left. Just return null.
+ }
+ }
+ return result;
+ }
+
+ public String getNegotiatedSubprotocol(List<String> supported,
+ List<String> requested) {
+ return
fetchContainerDefaultConfigurator().getNegotiatedSubprotocol(supported,
requested);
+ }
+
+
+ public List<Extension> getNegotiatedExtensions(List<Extension>
installed,
+ List<Extension> requested) {
+ return
fetchContainerDefaultConfigurator().getNegotiatedExtensions(installed,
requested);
+ }
+
+
+ public boolean checkOrigin(String originHeaderValue) {
+ return
fetchContainerDefaultConfigurator().checkOrigin(originHeaderValue);
+ }
+
+
+ public boolean matchesURI(String path, URI requestUri,
+ Map<String, String> templateExpansion) {
+ return fetchContainerDefaultConfigurator().matchesURI(path,
requestUri, templateExpansion);
+ }
+
+
+ public void modifyHandshake(ServerEndpointConfig sec,
+ HandshakeRequest request, HandshakeResponse response) {
+ fetchContainerDefaultConfigurator().modifyHandshake(sec, request,
response);
+ }
+ }
}
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsContainerProvider.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsContainerProvider.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsContainerProvider.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsContainerProvider.java Wed
Mar 6 14:45:24 2013
@@ -17,18 +17,12 @@
package org.apache.tomcat.websocket;
import javax.websocket.ContainerProvider;
+import javax.websocket.WebSocketContainer;
public class WsContainerProvider extends ContainerProvider {
@Override
- protected <T> T getContainer(Class<T> containerClass) {
- if (containerClass.isAssignableFrom(WsWebSocketContainer.class)) {
- @SuppressWarnings("unchecked")
- T result = (T) new WsWebSocketContainer();
- return result;
- } else {
- // Not supported
- return null;
- }
+ protected WebSocketContainer getContainer() {
+ return new WsWebSocketContainer();
}
}
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpoint.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpoint.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoEndpoint.java Wed
Mar 6 14:45:24 2013
@@ -24,7 +24,7 @@ import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.MessageHandler;
import javax.websocket.Session;
-import javax.websocket.server.ServerEndpointConfiguration;
+import javax.websocket.server.ServerEndpointConfig;
/**
* Wrapper class for instances of POJOs annotated with
@@ -47,8 +47,8 @@ public class PojoEndpoint extends Endpoi
public void onOpen(Session session,
EndpointConfig endpointConfiguration) {
- ServerEndpointConfiguration sec =
- (ServerEndpointConfiguration) endpointConfiguration;
+ ServerEndpointConfig sec =
+ (ServerEndpointConfig) endpointConfiguration;
try {
pojo = sec.getEndpointClass().newInstance();
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java
Wed Mar 6 14:45:24 2013
@@ -24,11 +24,10 @@ import java.util.Map;
import javax.websocket.Extension;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
-import javax.websocket.server.ServerEndpointConfiguration;
-import javax.websocket.server.ServerEndpointConfigurator;
+import javax.websocket.server.ServerEndpointConfig;
public class DefaultServerEndpointConfigurator
- extends ServerEndpointConfigurator {
+ extends ServerEndpointConfig.Configurator {
@Override
public String getNegotiatedSubprotocol(List<String> supported,
@@ -96,7 +95,7 @@ public class DefaultServerEndpointConfig
}
@Override
- public void modifyHandshake(ServerEndpointConfiguration sec,
+ public void modifyHandshake(ServerEndpointConfig sec,
HandshakeRequest request, HandshakeResponse response) {
// NO-OP
}
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/websocket/server/ServerContainerImpl.java
Wed Mar 6 14:45:24 2013
@@ -25,8 +25,7 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import javax.websocket.DeploymentException;
import javax.websocket.server.ServerEndpoint;
-import javax.websocket.server.ServerEndpointConfiguration;
-import javax.websocket.server.ServerEndpointConfigurationBuilder;
+import javax.websocket.server.ServerEndpointConfig;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
@@ -74,7 +73,7 @@ public class ServerContainerImpl extends
private final WsWriteTimeout wsWriteTimeout = new WsWriteTimeout();
private volatile ServletContext servletContext = null;
- private final Map<String,ServerEndpointConfiguration> configMap =
+ private final Map<String,ServerEndpointConfig> configMap =
new ConcurrentHashMap<>();
private final Map<String,UriTemplate> templateMap =
new ConcurrentHashMap<>();
@@ -114,7 +113,7 @@ public class ServerContainerImpl extends
* @param sec The configuration to use when creating endpoint instances
* @throws DeploymentException
*/
- public void deploy(ServerEndpointConfiguration sec)
+ public void deploy(ServerEndpointConfig sec)
throws DeploymentException {
if (servletContext == null) {
throw new DeploymentException(
@@ -142,7 +141,7 @@ public class ServerContainerImpl extends
/**
- * Provides the equivalent of {@link #deploy(ServerEndpointConfiguration)}
+ * Provides the equivalent of {@link #deploy(ServerEndpointConfig)}
* for publishing plain old java objects (POJOs) that have been annotated
as
* WebSocket endpoints.
*
@@ -189,9 +188,9 @@ public class ServerContainerImpl extends
}
- public ServerEndpointConfiguration getServerEndpointConfiguration(
+ public ServerEndpointConfig getServerEndpointConfiguration(
String servletPath, Map<String,String> pathParameters) {
- ServerEndpointConfiguration sec = configMap.get(servletPath);
+ ServerEndpointConfig sec = configMap.get(servletPath);
if (sec != null) {
return sec;
}
@@ -199,7 +198,7 @@ public class ServerContainerImpl extends
if (pojo != null) {
PojoMethodMapping methodMapping = pojoMethodMap.get(pojo);
if (methodMapping != null) {
- sec = ServerEndpointConfigurationBuilder.create(
+ sec = ServerEndpointConfig.Builder.create(
pojo, methodMapping.getWsPath()).build();
sec.getUserProperties().put(
PojoEndpoint.POJO_PATH_PARAM_KEY, pathParameters);
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServlet.java Wed Mar
6 14:45:24 2013
@@ -41,7 +41,7 @@ import javax.servlet.http.HttpServletRes
import javax.servlet.http.HttpUpgradeHandler;
import javax.websocket.Endpoint;
import javax.websocket.Extension;
-import javax.websocket.server.ServerEndpointConfiguration;
+import javax.websocket.server.ServerEndpointConfig;
import javax.xml.bind.DatatypeConverter;
import org.apache.tomcat.websocket.Constants;
@@ -95,11 +95,11 @@ public class WsServlet extends HttpServl
ServerContainerImpl sc = ServerContainerImpl.getServerContainer();
Map<String,String> pathParameters = sc.getPathParameters(
req.getServletPath(), req.getPathInfo());
- ServerEndpointConfiguration sec = sc.getServerEndpointConfiguration(
+ ServerEndpointConfig sec = sc.getServerEndpointConfiguration(
req.getServletPath(), pathParameters);
// Origin check
String origin = req.getHeader("Origin");
- if (!sec.getServerEndpointConfigurator().checkOrigin(origin)) {
+ if (!sec.getConfigurator().checkOrigin(origin)) {
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -107,7 +107,7 @@ public class WsServlet extends HttpServl
List<String> subProtocols = getTokensFromHeader(req,
"Sec-WebSocket-Protocol");
if (!subProtocols.isEmpty()) {
- subProtocol = sec.getServerEndpointConfigurator().
+ subProtocol = sec.getConfigurator().
getNegotiatedSubprotocol(
sec.getSubprotocols(), subProtocols);
}
Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
(original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Wed Mar 6 14:45:24 2013
@@ -27,7 +27,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletContextEvent;
-import javax.websocket.ClientEndpointConfig.Builder;
+import javax.websocket.ClientEndpointConfig;
import javax.websocket.ContainerProvider;
import javax.websocket.DeploymentException;
import javax.websocket.Endpoint;
@@ -37,7 +37,7 @@ import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import javax.websocket.server.ServerEndpoint;
-import javax.websocket.server.ServerEndpointConfigurationBuilder;
+import javax.websocket.server.ServerEndpointConfig;
import org.junit.Assert;
import org.junit.Test;
@@ -84,7 +84,7 @@ public class TestWsWebSocketContainer ex
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
Session wsSession = wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://localhost:" + getPort() +
TesterEchoServer.Config.PATH_ASYNC));
CountDownLatch latch = new CountDownLatch(1);
@@ -115,7 +115,7 @@ public class TestWsWebSocketContainer ex
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("ftp://localhost:" + getPort() +
TesterEchoServer.Config.PATH_ASYNC));
}
@@ -134,7 +134,7 @@ public class TestWsWebSocketContainer ex
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://" + TesterEchoServer.Config.PATH_ASYNC));
}
@@ -222,7 +222,7 @@ public class TestWsWebSocketContainer ex
tomcat.start();
Session wsSession = wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://localhost:" + getPort() +
TesterEchoServer.Config.PATH_BASIC));
BasicHandler<?> handler;
@@ -293,7 +293,7 @@ public class TestWsWebSocketContainer ex
tomcat.start();
Session wsSession = wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://localhost:" + getPort() +
BlockingConfig.PATH));
if (!setTimeoutOnContainer) {
@@ -374,7 +374,7 @@ public class TestWsWebSocketContainer ex
tomcat.start();
Session wsSession = wsContainer.connectToServer(TesterEndpoint.class,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://localhost:" + getPort() +
ConstantTxConfig.PATH));
@@ -524,7 +524,7 @@ public class TestWsWebSocketContainer ex
super.contextInitialized(sce);
ServerContainerImpl sc = ServerContainerImpl.getServerContainer();
try {
- sc.deploy(ServerEndpointConfigurationBuilder.create(
+ sc.deploy(ServerEndpointConfig.Builder.create(
ConstantTxEndpoint.class, PATH).build());
if (TestWsWebSocketContainer.timoutOnContainer) {
sc.setAsyncSendTimeout(TIMEOUT_MS);
@@ -668,7 +668,7 @@ public class TestWsWebSocketContainer ex
private Session connectToEchoServerBasic(WebSocketContainer wsContainer,
Class<? extends Endpoint> clazz) throws Exception {
return wsContainer.connectToServer(clazz,
- Builder.create().build(),
+ ClientEndpointConfig.Builder.create().build(),
new URI("http://localhost:" + getPort() +
TesterEchoServer.Config.PATH_BASIC));
}
Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java?rev=1453350&r1=1453349&r2=1453350&view=diff
==============================================================================
---
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
(original)
+++
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/WsConfigListener.java
Wed Mar 6 14:45:24 2013
@@ -19,7 +19,7 @@ package websocket.echo;
import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.WebListener;
import javax.websocket.DeploymentException;
-import javax.websocket.server.ServerEndpointConfigurationBuilder;
+import javax.websocket.server.ServerEndpointConfig;
import org.apache.tomcat.websocket.server.ServerContainerImpl;
import org.apache.tomcat.websocket.server.WsListener;
@@ -32,7 +32,7 @@ public class WsConfigListener extends Ws
super.contextInitialized(sce);
ServerContainerImpl sc = ServerContainerImpl.getServerContainer();
try {
- sc.deploy(ServerEndpointConfigurationBuilder.create(
+ sc.deploy(ServerEndpointConfig.Builder.create(
EchoEndpoint.class,
"/websocket/echoProgrammatic").build());
} catch (DeploymentException e) {
throw new IllegalStateException(e);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]