List of usage examples for org.apache.http.impl.io ChunkedInputStream ChunkedInputStream
public ChunkedInputStream(SessionInputBuffer sessionInputBuffer)
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 www . ja va 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.//w ww.j ava 2 s .c o 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; }