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

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

Introduction

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

Prototype

@Override
    public HttpVersion protocolVersion() 

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  ww  w .  j ava 2 s.  co  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);
    }
}