Examples of BufferedHttpEntity


Examples of org.apache.http.entity.BufferedHttpEntity

   
    public HttpResponse doExecute(HttpUriRequest method) throws Exception {
        HttpClient client = new DefaultHttpClient();
        try {
            HttpResponse response = client.execute(method);
            response.setEntity(new BufferedHttpEntity(response.getEntity()));
            return response;
        } finally {
            client.getConnectionManager().shutdown();
        }
    }
View Full Code Here

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

Examples of org.apache.http.entity.BufferedHttpEntity

        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

Examples of org.apache.http.entity.BufferedHttpEntity

  }

  @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

Examples of org.apache.http.entity.BufferedHttpEntity

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

Examples of org.apache.http.entity.BufferedHttpEntity

     *
     * @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

Examples of org.apache.http.entity.BufferedHttpEntity

   *
   * @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

Examples of org.apache.http.entity.BufferedHttpEntity

   
    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

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

Examples of org.apache.http.entity.BufferedHttpEntity

    //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
TOP
Copyright © 2018 www.massapi.com. 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.