Example usage for org.apache.http.impl.io IdentityInputStream IdentityInputStream

List of usage examples for org.apache.http.impl.io IdentityInputStream IdentityInputStream

Introduction

In this page you can find the example usage for org.apache.http.impl.io IdentityInputStream IdentityInputStream.

Prototype

public IdentityInputStream(SessionInputBuffer sessionInputBuffer) 

Source Link

Usage

From source file:org.apache.axis2.transport.http.server.AxisHttpConnectionImpl.java

public HttpRequest receiveRequest() throws HttpException, IOException {
    HttpRequest request = (HttpRequest) this.requestParser.parse();
    if (HEADERLOG.isDebugEnabled()) {
        HEADERLOG.debug(">> " + request.getRequestLine().toString());
        for (HeaderIterator it = request.headerIterator(); it.hasNext();) {
            HEADERLOG.debug(">> " + it.nextHeader().toString());
        }//from   w  ww.  j a  v  a 2 s.  c o m
    }

    // Prepare input stream
    this.in = null;
    if (request instanceof HttpEntityEnclosingRequest) {
        long len = this.contentLenStrategy.determineLength(request);
        if (len == ContentLengthStrategy.CHUNKED) {
            this.in = new ChunkedInputStream(this.inbuffer);
        } else if (len == ContentLengthStrategy.IDENTITY) {
            this.in = new IdentityInputStream(this.inbuffer);
        } else {
            this.in = new ContentLengthInputStream(inbuffer, len);
        }
    }
    return request;
}

From source file:org.mycard.net.network.AndroidHttpClientConnection.java

/***
 * Return the next response entity./*from w  w  w .j ava 2s.co  m*/
 * @param headers contains values for parsing entity
 * @see HttpClientConnection#receiveResponseEntity(HttpResponse response)
 */
public HttpEntity receiveResponseEntity(final Headers headers) {
    assertOpen();
    BasicHttpEntity entity = new BasicHttpEntity();

    long len = determineLength(headers);
    if (len == ContentLengthStrategy.CHUNKED) {
        entity.setChunked(true);
        entity.setContentLength(-1);
        entity.setContent(new ChunkedInputStream(inbuffer));
    } else if (len == ContentLengthStrategy.IDENTITY) {
        entity.setChunked(false);
        entity.setContentLength(-1);
        entity.setContent(new IdentityInputStream(inbuffer));
    } else {
        entity.setChunked(false);
        entity.setContentLength(len);
        entity.setContent(new ContentLengthInputStream(inbuffer, len));
    }

    String contentTypeHeader = headers.getContentType();
    if (contentTypeHeader != null) {
        entity.setContentType(contentTypeHeader);
    }
    String contentEncodingHeader = headers.getContentEncoding();
    if (contentEncodingHeader != null) {
        entity.setContentEncoding(contentEncodingHeader);
    }

    return entity;
}