Example usage for io.netty.handler.codec.http DefaultHttpRequest uri

List of usage examples for io.netty.handler.codec.http DefaultHttpRequest uri

Introduction

In this page you can find the example usage for io.netty.handler.codec.http DefaultHttpRequest uri.

Prototype

String uri

To view the source code for io.netty.handler.codec.http DefaultHttpRequest uri.

Click Source Link

Usage

From source file:io.vertx.core.http.impl.WebSocketRequestHandler.java

License:Open Source License

/**
 * Handle the request once we have the full body.
 *//*from  w ww.ja v  a2  s .  c  o m*/
private void handle(HttpServerRequestImpl req, Buffer body) {
    DefaultHttpRequest nettyReq = req.getRequest();
    nettyReq = new DefaultFullHttpRequest(nettyReq.protocolVersion(), nettyReq.method(), nettyReq.uri(),
            body.getByteBuf(), nettyReq.headers(), EmptyHttpHeaders.INSTANCE);
    req.setRequest(nettyReq);
    ServerWebSocketImpl ws = ((Http1xServerConnection) req.connection()).createWebSocket(req);
    if (METRICS_ENABLED && metrics != null) {
        ws.setMetric(metrics.connected(((Http1xServerConnection) req.connection()).metric(), ws));
    }
    if (handlers.wsHandler != null) {
        handlers.wsHandler.handle(ws);
        if (!ws.isRejected()) {
            ws.connectNow();
        } else {
            req.response().setStatusCode(ws.getRejectedStatus().code()).end();
        }
    } else {
        handlers.requestHandler.handle(req);
    }
}