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

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

Introduction

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

Prototype

public abstract Integer getInt(CharSequence name);

Source Link

Document

Returns the integer value of a header with the specified name.

Usage

From source file:com.vmware.xenon.common.http.netty.NettyHttpToHttp2Handler.java

License:Open Source License

/**
 * Analogous to the {@link HttpToHttp2ConnectionHandler#getStreamId}.
 * However, behavior has changed NOT to modify the state of the instance since original
 * method changes state(increments nextReservationStreamId) and is called at
 * {@link #write(ChannelHandlerContext, Object, ChannelPromise)} subsequent to this method.
 *//*from   w  w w  . java2 s  . co  m*/
private int getStreamId(HttpHeaders httpHeaders) {
    // when streamId in header is invalid(invalid format,etc), this throws exception
    Integer streamId = httpHeaders.getInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text());

    if (streamId != null) {
        return streamId;
    }
    return getDefaultStreamId();
}