Package org.apache.http

Examples of org.apache.http.HttpResponseInterceptor


  /**
   * This method is used to capture Location headers after HttpClient redirect handling.
   */
  private void setupClient(final AbstractHttpClient client) {
    this.client.addResponseInterceptor(new HttpResponseInterceptor() {
      @Override
      public void process(final HttpResponse response, final HttpContext context)
          throws HttpException, IOException {
        Header header = response.getFirstHeader("Location");
        if (header!=null)
View Full Code Here


            }
         }

      });

      client.addResponseInterceptor(new HttpResponseInterceptor()
      {

         @Override
         public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException
         {
View Full Code Here

//              return isRedirect;
//          }
//      });
   
    //设置响应拦截器
        httpClient.addResponseInterceptor(new HttpResponseInterceptor() {
            public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException {
                HttpEntity entity = response.getEntity();
                Header contentEncoding = entity.getContentEncoding();
                if (contentEncoding != null) {
                    HeaderElement[] codecs = contentEncoding.getElements();
View Full Code Here

                    request.addHeader("Accept-Encoding", "gzip");
                }
            }
        });

        defaultHttpClient.addResponseInterceptor(new HttpResponseInterceptor() {
            public void process(final HttpResponse response, final HttpContext context)
                throws HttpException, IOException {
                HttpEntity entity = response.getEntity();
                Header ceheader = entity.getContentEncoding();
                if (ceheader != null) {
View Full Code Here

                }
            }

        });
       
        httpclient.addResponseInterceptor(new HttpResponseInterceptor() {
          
            public void process(
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                HttpEntity entity = response.getEntity();
View Full Code Here

            final HttpResponse response,
            final HttpContext context)
            throws IOException, HttpException {
        if (this.responseInterceptors != null) {
            for (int i = 0; i < this.responseInterceptors.size(); i++) {
                HttpResponseInterceptor interceptor =
                    (HttpResponseInterceptor) this.responseInterceptors.get(i);
                interceptor.process(response, context);
            }
        }
    }
View Full Code Here

                }
            }

        });
       
        httpclient.addResponseInterceptor(new HttpResponseInterceptor() {
          
            public void process(
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                HttpEntity entity = response.getEntity();
View Full Code Here

        if (!request.containsHeader("Accept-Encoding")) {
          request.addHeader("Accept-Encoding", "gzip, deflate");
        }
      }
    });
    client.addResponseInterceptor(new HttpResponseInterceptor() {
      public void process(
          final org.apache.http.HttpResponse response,
          final HttpContext context) throws HttpException, IOException {
        HttpEntity entity = response.getEntity();
        if (entity != null) {
View Full Code Here

        });

        /* Get around Java The Language's lack of mutable closures */
        final boolean clientSawGzip[] = new boolean[1];

        client.addResponseInterceptor(new HttpResponseInterceptor() {

            /**
             * {@inheritDoc}
             */
            public void process(
View Full Code Here

        if (!request.containsHeader("Accept-Encoding")) {
          request.addHeader("Accept-Encoding", "gzip, deflate");
        }
      }
    });
    client.addResponseInterceptor(new HttpResponseInterceptor() {
      public void process(
          final org.apache.http.HttpResponse response,
          final HttpContext context) throws HttpException, IOException {
        HttpEntity entity = response.getEntity();
        if (entity != null) {
View Full Code Here

TOP

Related Classes of org.apache.http.HttpResponseInterceptor

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.