Issue #3380 - Adding configured Connection.Listeners to WebSocket Connections
Signed-off-by: Joakim Erdfelt <joakim@erdfelt.com>
This commit is contained in:
parent
cff63f2b6a
commit
0f4294e95a
|
@ -46,6 +46,7 @@ import org.eclipse.jetty.http.HttpScheme;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.io.ByteBufferPool;
|
import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.util.B64Code;
|
import org.eclipse.jetty.util.B64Code;
|
||||||
import org.eclipse.jetty.util.QuotedStringTokenizer;
|
import org.eclipse.jetty.util.QuotedStringTokenizer;
|
||||||
|
@ -338,6 +339,10 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon
|
||||||
|
|
||||||
WebSocketChannel wsChannel = newWebSocketChannel(frameHandler, negotiated);
|
WebSocketChannel wsChannel = newWebSocketChannel(frameHandler, negotiated);
|
||||||
WebSocketConnection wsConnection = newWebSocketConnection(endp, httpClient.getExecutor(), httpClient.getByteBufferPool(), wsChannel);
|
WebSocketConnection wsConnection = newWebSocketConnection(endp, httpClient.getExecutor(), httpClient.getByteBufferPool(), wsChannel);
|
||||||
|
|
||||||
|
for (Connection.Listener listener : wsClient.getBeans(Connection.Listener.class))
|
||||||
|
wsConnection.addListener(listener);
|
||||||
|
|
||||||
wsChannel.setWebSocketConnection(wsConnection);
|
wsChannel.setWebSocketConnection(wsConnection);
|
||||||
|
|
||||||
wsClient.customize(wsChannel);
|
wsClient.customize(wsChannel);
|
||||||
|
|
|
@ -18,12 +18,18 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.core.server.internal;
|
package org.eclipse.jetty.websocket.core.server.internal;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpField;
|
import org.eclipse.jetty.http.HttpField;
|
||||||
import org.eclipse.jetty.http.HttpHeader;
|
import org.eclipse.jetty.http.HttpHeader;
|
||||||
import org.eclipse.jetty.http.HttpMethod;
|
import org.eclipse.jetty.http.HttpMethod;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.http.PreEncodedHttpField;
|
import org.eclipse.jetty.http.PreEncodedHttpField;
|
||||||
import org.eclipse.jetty.io.ByteBufferPool;
|
import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.server.ConnectionFactory;
|
import org.eclipse.jetty.server.ConnectionFactory;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
|
@ -46,11 +52,6 @@ import org.eclipse.jetty.websocket.core.server.Handshaker;
|
||||||
import org.eclipse.jetty.websocket.core.server.Negotiation;
|
import org.eclipse.jetty.websocket.core.server.Negotiation;
|
||||||
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
|
|
||||||
public final class RFC6455Handshaker implements Handshaker
|
public final class RFC6455Handshaker implements Handshaker
|
||||||
{
|
{
|
||||||
static final Logger LOG = Log.getLogger(RFC6455Handshaker.class);
|
static final Logger LOG = Log.getLogger(RFC6455Handshaker.class);
|
||||||
|
@ -193,6 +194,9 @@ public final class RFC6455Handshaker implements Handshaker
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Connection.Listener listener : connector.getBeans(Connection.Listener.class))
|
||||||
|
connection.addListener(listener);
|
||||||
|
|
||||||
channel.setWebSocketConnection(connection);
|
channel.setWebSocketConnection(connection);
|
||||||
if (defaultCustomizer!=null)
|
if (defaultCustomizer!=null)
|
||||||
defaultCustomizer.customize(channel);
|
defaultCustomizer.customize(channel);
|
||||||
|
|
Loading…
Reference in New Issue