Package org.apache.http.entity

Examples of org.apache.http.entity.BufferedHttpEntity


        if (status > 299) {

            // Buffer response content
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                response.setEntity(new BufferedHttpEntity(entity));
            }

            this.managedConn.close();
            throw new TunnelRefusedException("CONNECT refused by proxy: " +
                    response.getStatusLine(), response);
View Full Code Here


        if (status > 299) {

            // Buffer response content
            final HttpEntity entity = response.getEntity();
            if (entity != null) {
                response.setEntity(new BufferedHttpEntity(entity));
            }

            this.managedConn.close();
            throw new TunnelRefusedException("CONNECT refused by proxy: " +
                    response.getStatusLine(), response);
View Full Code Here

  }

  @Override
  public void completed(final HttpResponse response) {
    try {
      response.setEntity(new BufferedHttpEntity(response.getEntity()));
    } catch(IOException ex) {
      throw new RuntimeException("Could not convert HttpEntity content.");
    }

    int statusCode = response.getStatusLine().getStatusCode();
View Full Code Here

            if(!isBufferingEnabled) {
                // TODO return InputStreamEntity
                return httpEntity;
            } else {
                return new BufferedHttpEntity(httpEntity);
            }
        } catch (Exception ex) {
            // TODO warning/error?
        }
View Full Code Here

     *
     * @return A new BufferedHttpEntity wrapping the specified entity.
     */
    private HttpEntity newBufferedHttpEntity(HttpEntity entity) {
        try {
            return new BufferedHttpEntity(entity);
        } catch (IOException e) {
            throw new AmazonClientException("Unable to create HTTP entity: " + e.getMessage(), e);
        }
    }
View Full Code Here

   *
   * @return A new BufferedHttpEntity wrapping the specified entity.
   */
  private HttpEntity newBufferedHttpEntity(HttpEntity entity) {
    try {
      return new BufferedHttpEntity(entity);
    } catch (IOException e) {
      throw new AmazonClientException("Unable to create HTTP entity: " + e.getMessage(), e);
    }
  }
View Full Code Here

   
    public HttpResponse doExecute(HttpUriRequest method) throws Exception {
        CloseableHttpClient client = HttpClientBuilder.create().build();
        try {
            HttpResponse response = client.execute(method);
            response.setEntity(new BufferedHttpEntity(response.getEntity()));
            return response;
        } finally {
            client.close();
        }
    }
View Full Code Here

        if (status > 299) {

            // Buffer response content
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                response.setEntity(new BufferedHttpEntity(entity));
            }               
           
            this.managedConn.close();
            throw new TunnelRefusedException("CONNECT refused by proxy: " +
                    response.getStatusLine(), response);
View Full Code Here

    //Reading the content to the buffered.
    //contentObtained = false: Content does not get yet.
    //contentObtained = true: Content is buffered by BufferedHttpEntity.
    if (entity != null && entity.isStreaming()) {
      try {
        entity = new BufferedHttpEntity(entity);
        //important to setEntity return to Response. If don't assign again, next to get
        //, you can not get the response content
        response.setEntity(entity);
      } catch (IOException ioex) {
        throw new SocialHttpClientException(ioex.toString(), ioex);
View Full Code Here

     * @return A new BufferedHttpEntity wrapping the specified entity.
     * @throws FakeIOException only for test simulation
     */
    private HttpEntity newBufferedHttpEntity(HttpEntity entity) throws FakeIOException {
        try {
            return new BufferedHttpEntity(entity);
        } catch(FakeIOException e) {
            throw e;
        } catch (IOException e) {
            throw new AmazonClientException("Unable to create HTTP entity: " + e.getMessage(), e);
        }
View Full Code Here

TOP

Related Classes of org.apache.http.entity.BufferedHttpEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.