This closes #206

This commit is contained in:
Clebert Suconic 2015-10-20 18:24:09 -04:00
commit e1be56d7ee
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 {