ARTEMIS-271 Expose HttpRequest in WebSocketServerHandler

This commit is contained in:
Julian Scheid 2015-10-20 23:12:18 +02:00 committed by Clebert Suconic
parent 7afd337496
commit aa492fb9b6
1 changed files with 6 additions and 0 deletions

View File

@ -49,6 +49,7 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>
private static final String WEBSOCKET_PATH = "/stomp";
private HttpRequest httpRequest;
private WebSocketServerHandshaker handshaker;
private static final BinaryWebSocketEncoder BINARY_WEBSOCKET_ENCODER = new BinaryWebSocketEncoder();
@ -75,6 +76,7 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>
// Handshake
WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(this.getWebSocketLocation(req), "v10.stomp,v11.stomp", false);
this.httpRequest = req;
this.handshaker = wsFactory.newHandshaker(req);
if (this.handshaker == null) {
WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
@ -140,6 +142,10 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>
return "ws://" + req.headers().get(HttpHeaders.Names.HOST) + WEBSOCKET_PATH;
}
public HttpRequest getHttpRequest() {
return this.httpRequest;
}
@Sharable
private static final class BinaryWebSocketEncoder extends ChannelOutboundHandlerAdapter {