@Override public String query() { if (query == null) { query = HttpUtils.parseQuery(uri()); } return query; }
@Override public String path() { if (path == null) { path = HttpUtils.parsePath(uri()); } return path; }
@Override public MultiMap params() { if (params == null) { params = HttpUtils.params(uri()); } return params; }
ServerWebSocketImpl createWebSocket(HttpServerRequestImpl request) { if (ws != null) { return ws; } if (!(request.getRequest() instanceof FullHttpRequest)) { throw new IllegalStateException(); } FullHttpRequest nettyReq = (FullHttpRequest) request.getRequest(); WebSocketServerHandshaker handshaker = createHandshaker(nettyReq); if (handshaker == null) { return null; } Function<ServerWebSocketImpl, String> f = ws -> { handshaker.handshake(chctx.channel(), nettyReq); // remove compressor as its not needed anymore once connection was upgraded to websockets ChannelHandler handler = chctx.pipeline().get(HttpChunkContentCompressor.class); if (handler != null) { chctx.pipeline().remove(handler); } ws.registerHandler(vertx.eventBus()); return handshaker.selectedSubprotocol(); }; ws = new ServerWebSocketImpl(vertx, request.uri(), request.path(), request.query(), request.headers(), this, handshaker.version() != WebSocketVersion.V00, f, options.getMaxWebsocketFrameSize(), options.getMaxWebsocketMessageSize()); if (METRICS_ENABLED && metrics != null) { ws.setMetric(metrics.connected(metric(), request.metric(), ws)); } return ws; }
@Override public String path() { if (path == null) { path = HttpUtils.parsePath(uri()); } return path; }
@Override public String query() { if (query == null) { query = HttpUtils.parseQuery(uri()); } return query; }
@Override public MultiMap params() { if (params == null) { params = HttpUtils.params(uri()); } return params; }
ServerWebSocketImpl createWebSocket(HttpServerRequestImpl request) { if (ws != null) { return ws; } if (!(request.getRequest() instanceof FullHttpRequest)) { throw new IllegalStateException(); } FullHttpRequest nettyReq = (FullHttpRequest) request.getRequest(); WebSocketServerHandshaker handshaker = createHandshaker(nettyReq); if (handshaker == null) { return null; } Function<ServerWebSocketImpl, String> f = ws -> { handshaker.handshake(chctx.channel(), nettyReq); // remove compressor as its not needed anymore once connection was upgraded to websockets ChannelHandler handler = chctx.pipeline().get(HttpChunkContentCompressor.class); if (handler != null) { chctx.pipeline().remove(handler); } ws.registerHandler(vertx.eventBus()); return handshaker.selectedSubprotocol(); }; ws = new ServerWebSocketImpl(vertx, request.uri(), request.path(), request.query(), request.headers(), this, handshaker.version() != WebSocketVersion.V00, f, options.getMaxWebsocketFrameSize(), options.getMaxWebsocketMessageSize()); if (METRICS_ENABLED && metrics != null) { ws.setMetric(metrics.connected(metric(), request.metric(), ws)); } return ws; }