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, int defaultValue) 

Source Link

Usage

From source file:com.cu.http.container.core.adaptor.NettyServletRequest.java

License:Apache License

@Override
public int getIntHeader(String name) {
    return HttpHeaders.getIntHeader(this.originalRequest, name, -1);
}

From source file:com.github.ambry.admin.AdminIntegrationTest.java

License:Open Source License

/**
 * Combines all the parts in {@code contents} into one {@link ByteBuffer}.
 * @param response the {@link HttpResponse} containing headers.
 * @param contents the content of the response.
 * @return a {@link ByteBuffer} that contains all the data in {@code contents}.
 */// www. j  a  v a  2  s  .c  o  m
private ByteBuffer getContent(HttpResponse response, Queue<HttpObject> contents) {
    long contentLength = HttpHeaders.getContentLength(response, -1);
    if (contentLength == -1) {
        contentLength = HttpHeaders.getIntHeader(response, RestUtils.Headers.BLOB_SIZE, 0);
    }
    ByteBuffer buffer = ByteBuffer.allocate((int) contentLength);
    for (HttpObject object : contents) {
        HttpContent content = (HttpContent) object;
        buffer.put(content.content().nioBuffer());
        ReferenceCountUtil.release(content);
    }
    return buffer;
}

From source file:com.github.ambry.frontend.FrontendIntegrationTest.java

License:Open Source License

/**
 * Combines all the parts in {@code contents} into one {@link ByteBuffer}.
 * @param response the {@link HttpResponse} containing headers.
 * @param contents the content of the response.
 * @return a {@link ByteBuffer} that contains all the data in {@code contents}.
 *//*  w w w  . ja  v  a 2  s.c  om*/
private ByteBuffer getContent(HttpResponse response, Queue<HttpObject> contents) {
    long contentLength = HttpHeaders.getContentLength(response, -1);
    if (contentLength == -1) {
        contentLength = HttpHeaders.getIntHeader(response, RestUtils.Headers.BLOB_SIZE, 0);
    }
    ByteBuffer buffer = ByteBuffer.allocate((int) contentLength);
    boolean endMarkerFound = false;
    for (HttpObject object : contents) {
        assertFalse("There should have been no more data after the end marker was found", endMarkerFound);
        HttpContent content = (HttpContent) object;
        buffer.put(content.content().nioBuffer());
        endMarkerFound = object instanceof LastHttpContent;
        ReferenceCountUtil.release(content);
    }
    return buffer;
}

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

License:Apache License

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

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

License:Apache License

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

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

License:Apache License

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

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

License:Apache License

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

From source file:org.ireland.jnetty.http.HttpServletRequestImpl.java

License:Open Source License

@Override
// OK
public int getIntHeader(String name) {
    return HttpHeaders.getIntHeader(request, name, -1);
}