Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2015-03-10 17:27:07 +0000
committerJoakim Erdfelt2015-03-12 17:09:52 +0000
commitdc81cda742b354138fd3f78c815aa9d81ae2e078 (patch)
tree87495872a728cfe11340aedce04b7ea1d05d70e4 /jetty-websocket
parent31ee46d4825bec41ab0bd7aff2a458936b517321 (diff)
downloadorg.eclipse.jetty.project-dc81cda742b354138fd3f78c815aa9d81ae2e078.tar.gz
org.eclipse.jetty.project-dc81cda742b354138fd3f78c815aa9d81ae2e078.tar.xz
org.eclipse.jetty.project-dc81cda742b354138fd3f78c815aa9d81ae2e078.zip
Using Jetty component listeners for CDI
Diffstat (limited to 'jetty-websocket')
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java26
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java1
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java31
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java4
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/SimpleContainerScope.java27
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketContainerScope.java27
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeEvents.java99
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScope.java (renamed from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeListener.java)39
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScopeTest.java78
-rw-r--r--jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java30
10 files changed, 103 insertions, 259 deletions
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
index 0cefc85d53..51569e256e 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -59,8 +58,6 @@ import org.eclipse.jetty.websocket.common.SessionListener;
import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope;
import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeEvents;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeListener;
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
import org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata;
import org.eclipse.jetty.websocket.jsr356.client.EmptyClientEndpointConfig;
@@ -119,12 +116,6 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
ShutdownThread.register(this);
}
- @Override
- public void addScopeListener(WebSocketScopeListener listener)
- {
- this.scopeDelegate.addScopeListener(listener);
- }
-
private Session connect(EndpointInstance instance, URI path) throws IOException
{
Objects.requireNonNull(instance,"EndpointInstance cannot be null");
@@ -351,17 +342,6 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
return scopeDelegate.getPolicy();
}
- public WebSocketScopeEvents getScopeEvents()
- {
- return scopeDelegate.getScopeEvents();
- }
-
- @Override
- public List<WebSocketScopeListener> getScopeListeners()
- {
- return scopeDelegate.getScopeListeners();
- }
-
@Override
public SslContextFactory getSslContextFactory()
{
@@ -427,12 +407,6 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
}
@Override
- public void removeScopeListener(WebSocketScopeListener listener)
- {
- scopeDelegate.removeScopeListener(listener);
- }
-
- @Override
public void setAsyncSendTimeout(long ms)
{
client.setAsyncWriteTimeout(ms);
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
index 745daabe0f..3891e760e0 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
@@ -148,6 +148,7 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
{
if (onError == null)
{
+ LOG.warn("Unable to report throwable to websocket (no @OnError handler declared): " + websocket.getClass().getName(), cause);
return;
}
onError.call(websocket,cause);
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
index 7200921da5..399257d23e 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
@@ -24,7 +24,6 @@ import java.net.SocketAddress;
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -61,8 +60,6 @@ import org.eclipse.jetty.websocket.common.events.EventDriver;
import org.eclipse.jetty.websocket.common.events.EventDriverFactory;
import org.eclipse.jetty.websocket.common.extensions.WebSocketExtensionFactory;
import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeEvents;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeListener;
/**
* WebSocketClient provides a means of establishing connections to remote websocket endpoints.
@@ -74,7 +71,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
private final WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
private final SslContextFactory sslContextFactory;
private final WebSocketExtensionFactory extensionRegistry;
- private WebSocketScopeEvents scopeEvents = new WebSocketScopeEvents();
private boolean daemon = false;
private EventDriverFactory eventDriverFactory;
private SessionFactory sessionFactory;
@@ -150,12 +146,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
addBean(this.bufferPool);
}
- @Override
- public void addScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.addScopeListener(listener);
- }
-
public Future<Session> connect(Object websocket, URI toUri) throws IOException
{
ClientUpgradeRequest request = new ClientUpgradeRequest(toUri);
@@ -291,8 +281,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
super.doStart();
- scopeEvents.fireContainerActivated(this);
-
if (LOG.isDebugEnabled())
LOG.debug("Started {}",this);
}
@@ -316,8 +304,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
super.doStop();
- scopeEvents.fireContainerDeactivated(this);
-
if (LOG.isDebugEnabled())
LOG.debug("Stopped {}",this);
}
@@ -453,17 +439,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
return scheduler;
}
- public WebSocketScopeEvents getScopeEvents()
- {
- return scopeEvents;
- }
-
- @Override
- public List<WebSocketScopeListener> getScopeListeners()
- {
- return this.scopeEvents.getScopeListeners();
- }
-
public SessionFactory getSessionFactory()
{
return sessionFactory;
@@ -531,12 +506,6 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
LOG.debug("Session Opened: {}",session);
}
- @Override
- public void removeScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.removeScopeListener(listener);
- }
-
public void setAsyncWriteTimeout(long ms)
{
this.policy.setAsyncWriteTimeout(ms);
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
index 530c010b92..b8a20c3efb 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
@@ -275,7 +275,9 @@ public class UpgradeConnection extends AbstractConnection
// Validate Response Status Code
if (response.getStatusCode() != SWITCHING_PROTOCOLS)
{
- throw new UpgradeException(request.getRequestURI(),response.getStatusCode(),"Didn't switch protocols");
+ // TODO: use jetty-http and org.eclipse.jetty.http.HttpStatus for more meaningful exception messages
+ throw new UpgradeException(request.getRequestURI(),response.getStatusCode(),"Didn't switch protocols, expected status <" + SWITCHING_PROTOCOLS
+ + ">, but got <" + response.getStatusCode() + ">");
}
// Validate Connection header
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/SimpleContainerScope.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/SimpleContainerScope.java
index 935583e5f6..f407f8bafd 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/SimpleContainerScope.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/SimpleContainerScope.java
@@ -18,7 +18,6 @@
package org.eclipse.jetty.websocket.common.scopes;
-import java.util.List;
import java.util.concurrent.Executor;
import org.eclipse.jetty.io.ByteBufferPool;
@@ -36,7 +35,6 @@ public class SimpleContainerScope extends ContainerLifeCycle implements WebSocke
private final WebSocketPolicy policy;
private Executor executor;
private SslContextFactory sslContextFactory;
- private WebSocketScopeEvents scopeEvents = new WebSocketScopeEvents();
public SimpleContainerScope(WebSocketPolicy policy)
{
@@ -65,14 +63,12 @@ public class SimpleContainerScope extends ContainerLifeCycle implements WebSocke
protected void doStart() throws Exception
{
super.doStart();
- scopeEvents.fireContainerActivated(this);
}
@Override
protected void doStop() throws Exception
{
super.doStop();
- scopeEvents.fireContainerDeactivated(this);
}
@Override
@@ -109,27 +105,4 @@ public class SimpleContainerScope extends ContainerLifeCycle implements WebSocke
{
this.sslContextFactory = sslContextFactory;
}
-
- public WebSocketScopeEvents getScopeEvents()
- {
- return scopeEvents;
- }
-
- @Override
- public void addScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.addScopeListener(listener);
- }
-
- @Override
- public void removeScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.removeScopeListener(listener);
- }
-
- @Override
- public List<WebSocketScopeListener> getScopeListeners()
- {
- return this.scopeEvents.getScopeListeners();
- }
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketContainerScope.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketContainerScope.java
index 1f65f1bc26..acc611f778 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketContainerScope.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketContainerScope.java
@@ -18,7 +18,6 @@
package org.eclipse.jetty.websocket.common.scopes;
-import java.util.List;
import java.util.concurrent.Executor;
import org.eclipse.jetty.io.ByteBufferPool;
@@ -32,32 +31,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
public interface WebSocketContainerScope
{
/**
- * Add a {@link WebSocketScopeListener} for this container.
- *
- * @param listener
- * the listener to receive container scope events
- */
- public void addScopeListener(WebSocketScopeListener listener);
-
- /**
- * Remove a {@link WebSocketScopeListener} from this container
- *
- * @param listener
- * the listener to receive websocket scope events
- */
- public void removeScopeListener(WebSocketScopeListener listener);
-
- /**
- * Get the current list of {@link WebSocketScopeListener}s for this container
- */
- public List<WebSocketScopeListener> getScopeListeners();
-
- /**
- * Get the WebSocketScopeEvents handler, for firing {@link WebSocketScopeListener} events.
- */
- public WebSocketScopeEvents getScopeEvents();
-
- /**
* The configured Container Buffer Pool.
*
* @return the buffer pool (never null)
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeEvents.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeEvents.java
deleted file mode 100644
index 6294aa3bc2..0000000000
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeEvents.java
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
-// ------------------------------------------------------------------------
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// and Apache License v2.0 which accompanies this distribution.
-//
-// The Eclipse Public License is available at
-// http://www.eclipse.org/legal/epl-v10.html
-//
-// The Apache License v2.0 is available at
-// http://www.opensource.org/licenses/apache2.0.php
-//
-// You may elect to redistribute this code under either of these licenses.
-// ========================================================================
-//
-
-package org.eclipse.jetty.websocket.common.scopes;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class WebSocketScopeEvents
-{
- private List<WebSocketScopeListener> scopeListeners;
-
- public void addScopeListener(WebSocketScopeListener listener)
- {
- if (scopeListeners == null)
- {
- scopeListeners = new ArrayList<>();
- }
- scopeListeners.add(listener);
- }
-
- public void fireContainerActivated(WebSocketContainerScope container)
- {
- if (scopeListeners != null)
- {
- for (WebSocketScopeListener listener : scopeListeners)
- {
- listener.onWebSocketContainerActivated(container);
- }
- }
- }
-
- public void fireContainerDeactivated(WebSocketContainerScope container)
- {
- if (scopeListeners != null)
- {
- for (WebSocketScopeListener listener : scopeListeners)
- {
- listener.onWebSocketContainerDeactivated(container);
- }
- }
- }
-
- public void fireSessionActivated(WebSocketSessionScope session)
- {
- if (scopeListeners != null)
- {
- for (WebSocketScopeListener listener : scopeListeners)
- {
- listener.onWebSocketSessionActivated(session);
- }
- }
- }
-
- public void fireSessionDeactivated(WebSocketSessionScope session)
- {
- if (scopeListeners != null)
- {
- for (WebSocketScopeListener listener : scopeListeners)
- {
- listener.onWebSocketSessionDeactivated(session);
- }
- }
- }
-
- public List<WebSocketScopeListener> getScopeListeners()
- {
- if (scopeListeners == null)
- {
- return Collections.emptyList();
- }
- return Collections.unmodifiableList(scopeListeners);
- }
-
- public void removeScopeListener(WebSocketScopeListener listener)
- {
- if (scopeListeners == null)
- {
- return;
- }
- scopeListeners.remove(listener);
- }
-}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeListener.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScope.java
index 5aca114e9b..5322583333 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/scopes/WebSocketScopeListener.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScope.java
@@ -16,27 +16,30 @@
// ========================================================================
//
-package org.eclipse.jetty.websocket.common.scopes;
+package org.eclipse.jetty.websocket.common.util;
-public interface WebSocketScopeListener
+import java.io.Closeable;
+
+public class ThreadClassLoaderScope implements Closeable
{
- /**
- * A WebSocket Container scope was created / activated
- */
- void onWebSocketContainerActivated(WebSocketContainerScope scope);
+ private final ClassLoader old;
+ private final ClassLoader scopedClassLoader;
- /**
- * A WebSocket Container scope was stopped / deactivated
- */
- void onWebSocketContainerDeactivated(WebSocketContainerScope scope);
+ public ThreadClassLoaderScope(ClassLoader cl)
+ {
+ old = Thread.currentThread().getContextClassLoader();
+ scopedClassLoader = cl;
+ Thread.currentThread().setContextClassLoader(scopedClassLoader);
+ }
- /**
- * A WebSocket Session scope was created / activated
- */
- void onWebSocketSessionActivated(WebSocketSessionScope scope);
+ @Override
+ public void close()
+ {
+ Thread.currentThread().setContextClassLoader(old);
+ }
- /**
- * A WebSocket Session scope was stopped / deactivated
- */
- void onWebSocketSessionDeactivated(WebSocketSessionScope scope);
+ public ClassLoader getScopedClassLoader()
+ {
+ return scopedClassLoader;
+ }
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScopeTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScopeTest.java
new file mode 100644
index 0000000000..28fe50efa2
--- /dev/null
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/ThreadClassLoaderScopeTest.java
@@ -0,0 +1,78 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.common.util;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.junit.Test;
+
+public class ThreadClassLoaderScopeTest
+{
+ private static class ClassLoaderFoo extends URLClassLoader
+ {
+ public ClassLoaderFoo()
+ {
+ super(new URL[0]);
+ }
+ }
+
+ private static class ClassLoaderBar extends URLClassLoader
+ {
+ public ClassLoaderBar()
+ {
+ super(new URL[0]);
+ }
+ }
+
+ @Test
+ public void testNormal()
+ {
+ try (ThreadClassLoaderScope scope = new ThreadClassLoaderScope(new ClassLoaderFoo()))
+ {
+ assertThat("ClassLoader in scope",Thread.currentThread().getContextClassLoader(),instanceOf(ClassLoaderFoo.class));
+ assertThat("Scoped ClassLoader",scope.getScopedClassLoader(),instanceOf(ClassLoaderFoo.class));
+ }
+ assertThat("ClassLoader after scope",Thread.currentThread().getContextClassLoader(),not(instanceOf(ClassLoaderFoo.class)));
+ }
+
+ @Test
+ public void testWithException()
+ {
+ try (ThreadClassLoaderScope scope = new ThreadClassLoaderScope(new ClassLoaderBar()))
+ {
+ assertThat("ClassLoader in 'scope'",Thread.currentThread().getContextClassLoader(),instanceOf(ClassLoaderBar.class));
+ assertThat("Scoped ClassLoader",scope.getScopedClassLoader(),instanceOf(ClassLoaderBar.class));
+ try (ThreadClassLoaderScope inner = new ThreadClassLoaderScope(new ClassLoaderFoo()))
+ {
+ assertThat("ClassLoader in 'inner'",Thread.currentThread().getContextClassLoader(),instanceOf(ClassLoaderFoo.class));
+ assertThat("Scoped ClassLoader",scope.getScopedClassLoader(),instanceOf(ClassLoaderFoo.class));
+ throw new RuntimeException("Intention exception");
+ }
+ }
+ catch (Throwable ignore)
+ {
+ /* ignore */
+ }
+ assertThat("ClassLoader after 'scope'",Thread.currentThread().getContextClassLoader(),not(instanceOf(ClassLoaderBar.class)));
+ }
+}
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
index 62d5738164..7f8fd830af 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
@@ -66,8 +66,6 @@ import org.eclipse.jetty.websocket.common.events.EventDriverFactory;
import org.eclipse.jetty.websocket.common.extensions.ExtensionStack;
import org.eclipse.jetty.websocket.common.extensions.WebSocketExtensionFactory;
import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeEvents;
-import org.eclipse.jetty.websocket.common.scopes.WebSocketScopeListener;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
@@ -97,7 +95,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
private WebSocketCreator creator;
private List<Class<?>> registeredSocketClasses;
private DecoratedObjectFactory objectFactory;
- private WebSocketScopeEvents scopeEvents = new WebSocketScopeEvents();
public WebSocketServerFactory()
{
@@ -209,12 +206,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
}
}
- @Override
- public void addScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.addScopeListener(listener);
- }
-
public void addSessionFactory(SessionFactory sessionFactory)
{
if (sessionFactories.contains(sessionFactory))
@@ -325,8 +316,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
}
super.doStart();
-
- scopeEvents.fireContainerActivated(this);
}
@Override
@@ -334,8 +323,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
{
shutdownAllConnections();
super.doStop();
-
- scopeEvents.fireContainerDeactivated(this);
}
@Override
@@ -383,17 +370,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
return defaultPolicy;
}
- public WebSocketScopeEvents getScopeEvents()
- {
- return scopeEvents;
- }
-
- @Override
- public List<WebSocketScopeListener> getScopeListeners()
- {
- return this.scopeEvents.getScopeListeners();
- }
-
@Override
public SslContextFactory getSslContextFactory()
{
@@ -541,12 +517,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
}
@Override
- public void removeScopeListener(WebSocketScopeListener listener)
- {
- this.scopeEvents.removeScopeListener(listener);
- }
-
- @Override
public void setCreator(WebSocketCreator creator)
{
this.creator = creator;

Back to the top