Example usage for io.netty.handler.codec.http HttpHeaders getIntHeader

List of usage examples for io.netty.handler.codec.http HttpHeaders getIntHeader

Introduction

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

Prototype

@Deprecated
public static int getIntHeader(HttpMessage message, CharSequence name) 

Source Link

Usage

From source file:com.twitter.http2.HttpStreamEncoder.java

License:Apache License

private HttpHeadersFrame createHttpHeadersFrame(HttpRequest httpRequest) throws Exception {
    // Get the Stream-ID from the headers
    int streamId = HttpHeaders.getIntHeader(httpRequest, "X-SPDY-Stream-ID");
    httpRequest.headers().remove("X-SPDY-Stream-ID");

    // The Connection, Keep-Alive, Proxy-Connection, and Transfer-Encoding
    // headers are not valid and MUST not be sent.
    httpRequest.headers().remove(HttpHeaders.Names.CONNECTION);
    httpRequest.headers().remove("Keep-Alive");
    httpRequest.headers().remove("Proxy-Connection");
    httpRequest.headers().remove(HttpHeaders.Names.TRANSFER_ENCODING);

    HttpHeadersFrame httpHeadersFrame = new DefaultHttpHeadersFrame(streamId);

    // Unfold the first line of the request into name/value pairs
    httpHeadersFrame.headers().add(":method", httpRequest.getMethod().name());
    httpHeadersFrame.headers().set(":scheme", "https");
    httpHeadersFrame.headers().add(":path", httpRequest.getUri());

    // Replace the HTTP host header with the SPDY host header
    String host = httpRequest.headers().get(HttpHeaders.Names.HOST);
    httpRequest.headers().remove(HttpHeaders.Names.HOST);
    httpHeadersFrame.headers().add(":authority", host);

    // Transfer the remaining HTTP headers
    for (Map.Entry<String, String> entry : httpRequest.headers()) {
        httpHeadersFrame.headers().add(entry.getKey(), entry.getValue());
    }/*from   ww  w.  j ava2s.  c  o  m*/

    return httpHeadersFrame;
}

From source file:com.twitter.http2.HttpStreamEncoder.java

License:Apache License

private HttpHeadersFrame createHttpHeadersFrame(HttpResponse httpResponse) throws Exception {
    // Get the Stream-ID from the headers
    int streamId = HttpHeaders.getIntHeader(httpResponse, "X-SPDY-Stream-ID");
    httpResponse.headers().remove("X-SPDY-Stream-ID");

    // The Connection, Keep-Alive, Proxy-Connection, and Transfer-Encoding
    // headers are not valid and MUST not be sent.
    httpResponse.headers().remove(HttpHeaders.Names.CONNECTION);
    httpResponse.headers().remove("Keep-Alive");
    httpResponse.headers().remove("Proxy-Connection");
    httpResponse.headers().remove(HttpHeaders.Names.TRANSFER_ENCODING);

    HttpHeadersFrame httpHeadersFrame = new DefaultHttpHeadersFrame(streamId);

    // Unfold the first line of the response into name/value pairs
    httpHeadersFrame.headers().set(":status", httpResponse.getStatus().code());

    // Transfer the remaining HTTP headers
    for (Map.Entry<String, String> entry : httpResponse.headers()) {
        httpHeadersFrame.headers().add(entry.getKey(), entry.getValue());
    }//from  w w w  .j  a  va 2  s  .  c  om

    return httpHeadersFrame;
}

From source file:io.reactivex.netty.protocol.http.client.HttpRequestHeaders.java

License:Apache License

public int getIntHeader(CharSequence name) {
    return HttpHeaders.getIntHeader(nettyRequest, name);
}

From source file:io.reactivex.netty.protocol.http.client.HttpRequestHeaders.java

License:Apache License

public int getIntHeader(String name) {
    return HttpHeaders.getIntHeader(nettyRequest, name);
}

From source file:io.reactivex.netty.protocol.http.client.HttpResponseHeaders.java

License:Apache License

public int getIntHeader(CharSequence name) {
    return HttpHeaders.getIntHeader(nettyResponse, name);
}

From source file:io.reactivex.netty.protocol.http.client.HttpResponseHeaders.java

License:Apache License

public int getIntHeader(String name) {
    return HttpHeaders.getIntHeader(nettyResponse, name);
}