Issue #3446 - renaming, code cleanup and fixes
rename WebSocketSessionImpl to WebSocketSession remove SessionListener which is unused and replaced by WebSocketSessionListener Signed-off-by: lachan-roberts <lachlan@webtide.com>
This commit is contained in:
parent
e9df97e314
commit
e355ec31b8
|
@ -71,7 +71,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler
|
|||
private MessageSink textSink;
|
||||
private MessageSink binarySink;
|
||||
private MessageSink activeMessageSink;
|
||||
private WebSocketSessionImpl session;
|
||||
private WebSocketSession session;
|
||||
|
||||
public JettyWebSocketFrameHandler(WebSocketContainer container,
|
||||
Object endpointInstance,
|
||||
|
@ -108,7 +108,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler
|
|||
this.customizer = customizer;
|
||||
}
|
||||
|
||||
public WebSocketSessionImpl getSession()
|
||||
public WebSocketSession getSession()
|
||||
{
|
||||
return session;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler
|
|||
{
|
||||
customizer.customize(coreSession);
|
||||
|
||||
session = new WebSocketSessionImpl(coreSession, this, upgradeRequest, upgradeResponse);
|
||||
session = new WebSocketSession(coreSession, this, upgradeRequest, upgradeResponse);
|
||||
|
||||
frameHandle = JettyWebSocketFrameHandlerFactory.bindTo(frameHandle, session);
|
||||
openHandle = JettyWebSocketFrameHandlerFactory.bindTo(openHandle, session);
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2019 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;
|
||||
|
||||
public interface SessionListener
|
||||
{
|
||||
void onCreated(WebSocketSessionImpl session);
|
||||
|
||||
void onOpened(WebSocketSessionImpl session);
|
||||
|
||||
void onClosed(WebSocketSessionImpl session);
|
||||
}
|
|
@ -36,13 +36,13 @@ public class SessionTracker extends AbstractLifeCycle implements WebSocketSessio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketSessionOpened(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionOpened(WebSocketSession session)
|
||||
{
|
||||
sessions.add(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketSessionClosed(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionClosed(WebSocketSession session)
|
||||
{
|
||||
sessions.remove(session);
|
||||
}
|
||||
|
|
|
@ -37,16 +37,16 @@ import org.eclipse.jetty.websocket.api.UpgradeResponse;
|
|||
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
|
||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||
|
||||
public class WebSocketSessionImpl extends AbstractLifeCycle implements Session, Dumpable
|
||||
public class WebSocketSession extends AbstractLifeCycle implements Session, Dumpable
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(WebSocketSessionImpl.class);
|
||||
private static final Logger LOG = Log.getLogger(WebSocketSession.class);
|
||||
private final FrameHandler.CoreSession coreSession;
|
||||
private final JettyWebSocketFrameHandler frameHandler;
|
||||
private final JettyWebSocketRemoteEndpoint remoteEndpoint;
|
||||
private final UpgradeRequest upgradeRequest;
|
||||
private final UpgradeResponse upgradeResponse;
|
||||
|
||||
public WebSocketSessionImpl(
|
||||
public WebSocketSession(
|
||||
FrameHandler.CoreSession coreSession,
|
||||
JettyWebSocketFrameHandler frameHandler,
|
||||
UpgradeRequest upgradeRequest,
|
||||
|
@ -254,6 +254,6 @@ public class WebSocketSessionImpl extends AbstractLifeCycle implements Session,
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("WebSocketSessionImpl[%s,to=%s,%s,%s]", getBehavior(), getIdleTimeout(), coreSession, frameHandler);
|
||||
return String.format("WebSocketSession[%s,to=%s,%s,%s]", getBehavior(), getIdleTimeout(), coreSession, frameHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ package org.eclipse.jetty.websocket.common;
|
|||
*/
|
||||
public interface WebSocketSessionListener
|
||||
{
|
||||
void onWebSocketSessionOpened(WebSocketSessionImpl session);
|
||||
void onWebSocketSessionOpened(WebSocketSession session);
|
||||
|
||||
void onWebSocketSessionClosed(WebSocketSessionImpl session);
|
||||
void onWebSocketSessionClosed(WebSocketSession session);
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@ public class JettyWebSocketServletContainerInitializer implements ServletContain
|
|||
FilterHolder filterHolder = WebSocketUpgradeFilter.ensureFilter(context.getServletContext());
|
||||
WebSocketMapping mapping = WebSocketMapping.ensureMapping(context.getServletContext(), WebSocketMapping.DEFAULT_KEY);
|
||||
JettyWebSocketServerContainer container = JettyWebSocketServerContainer.ensureContainer(context.getServletContext());
|
||||
JettyServerFrameHandlerFactory.ensureFactory(context.getServletContext());
|
||||
JettyServerFrameHandlerFactory factory = JettyServerFrameHandlerFactory.ensureFactory(context.getServletContext());
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onStartup {} {} {} {}", container, mapping, filterHolder, components);
|
||||
LOG.debug("configureContext {} {} {} {} {}", container, mapping, filterHolder, components, factory);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2019 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.tests;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.CountDownLatch;
|
|||
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSessionImpl;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSession;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSessionListener;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
@ -64,12 +64,12 @@ public class ClientOpenSessionTracker implements Connection.Listener, WebSocketS
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketSessionOpened(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionOpened(WebSocketSession session)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketSessionClosed(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionClosed(WebSocketSession session)
|
||||
{
|
||||
this.closeSessionLatch.countDown();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.jetty.websocket.api.StatusCode;
|
|||
import org.eclipse.jetty.websocket.api.util.WSURI;
|
||||
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSessionImpl;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSession;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSessionListener;
|
||||
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
|
||||
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
|
||||
|
@ -105,12 +105,12 @@ public class ClientSessionsTest
|
|||
|
||||
client.addSessionListener(new WebSocketSessionListener() {
|
||||
@Override
|
||||
public void onWebSocketSessionOpened(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionOpened(WebSocketSession session)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketSessionClosed(WebSocketSessionImpl session)
|
||||
public void onWebSocketSessionClosed(WebSocketSession session)
|
||||
{
|
||||
onSessionCloseLatch.countDown();
|
||||
}
|
||||
|
|
|
@ -81,13 +81,13 @@ public class SlowClientTest
|
|||
}
|
||||
});
|
||||
context.addServlet(websocket, "/ws");
|
||||
JettyWebSocketServletContainerInitializer.configureContext(context);
|
||||
|
||||
HandlerList handlers = new HandlerList();
|
||||
handlers.addHandler(context);
|
||||
handlers.addHandler(new DefaultHandler());
|
||||
|
||||
server.setHandler(handlers);
|
||||
JettyWebSocketServletContainerInitializer.configureContext(context);
|
||||
|
||||
server.start();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.jetty.websocket.api.StatusCode;
|
|||
import org.eclipse.jetty.websocket.api.util.WSURI;
|
||||
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSessionImpl;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSession;
|
||||
import org.eclipse.jetty.websocket.core.internal.WebSocketChannel;
|
||||
import org.eclipse.jetty.websocket.server.JettyWebSocketServletContainerInitializer;
|
||||
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
|
||||
|
@ -212,7 +212,7 @@ public class ServerCloseTest
|
|||
Future<Session> futSession = client.connect(clientEndpoint, wsUri, request);
|
||||
|
||||
Session session = null;
|
||||
try(StacklessLogging ignore = new StacklessLogging(WebSocketSessionImpl.class))
|
||||
try(StacklessLogging ignore = new StacklessLogging(WebSocketSession.class))
|
||||
{
|
||||
session = futSession.get(5, SECONDS);
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class ServerCloseTest
|
|||
Future<Session> futSession = client.connect(clientEndpoint, wsUri, request);
|
||||
|
||||
Session session = null;
|
||||
try(StacklessLogging ignore = new StacklessLogging(WebSocketSessionImpl.class))
|
||||
try(StacklessLogging ignore = new StacklessLogging(WebSocketSession.class))
|
||||
{
|
||||
session = futSession.get(5, SECONDS);
|
||||
|
||||
|
|
|
@ -81,13 +81,13 @@ public class SlowServerTest
|
|||
}
|
||||
});
|
||||
context.addServlet(websocket, "/ws");
|
||||
JettyWebSocketServletContainerInitializer.configureContext(context);
|
||||
|
||||
HandlerList handlers = new HandlerList();
|
||||
handlers.addHandler(context);
|
||||
handlers.addHandler(new DefaultHandler());
|
||||
|
||||
server.setHandler(handlers);
|
||||
JettyWebSocketServletContainerInitializer.configureContext(context);
|
||||
|
||||
server.start();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue