Example usage for org.apache.http.protocol BasicHttpProcessor getResponseInterceptor

List of usage examples for org.apache.http.protocol BasicHttpProcessor getResponseInterceptor

Introduction

In this page you can find the example usage for org.apache.http.protocol BasicHttpProcessor getResponseInterceptor.

Prototype

public HttpResponseInterceptor getResponseInterceptor(int i) 

Source Link

Usage

From source file:org.apache.http.impl.client.AbstractHttpClient.java

private synchronized HttpProcessor getProtocolProcessor() {
    if (protocolProcessor == null) {
        // Get mutable HTTP processor
        final BasicHttpProcessor proc = getHttpProcessor();
        // and create an immutable copy of it
        final int reqc = proc.getRequestInterceptorCount();
        final HttpRequestInterceptor[] reqinterceptors = new HttpRequestInterceptor[reqc];
        for (int i = 0; i < reqc; i++) {
            reqinterceptors[i] = proc.getRequestInterceptor(i);
        }/*from  w  ww . jav  a2s  .co  m*/
        final int resc = proc.getResponseInterceptorCount();
        final HttpResponseInterceptor[] resinterceptors = new HttpResponseInterceptor[resc];
        for (int i = 0; i < resc; i++) {
            resinterceptors[i] = proc.getResponseInterceptor(i);
        }
        protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors);
    }
    return protocolProcessor;
}

From source file:org.apache.http.impl.client.AbstractStatisticsGatheringHttpClient.java

private synchronized final HttpProcessor getProtocolProcessor() {
    if (protocolProcessor == null) {
        // Get mutable HTTP processor
        BasicHttpProcessor proc = getHttpProcessor();
        // and create an immutable copy of it
        int reqc = proc.getRequestInterceptorCount();
        HttpRequestInterceptor[] reqinterceptors = new HttpRequestInterceptor[reqc];
        for (int i = 0; i < reqc; i++) {
            reqinterceptors[i] = proc.getRequestInterceptor(i);
        }/*ww  w  .  j  a v  a  2  s  .c om*/
        int resc = proc.getResponseInterceptorCount();
        HttpResponseInterceptor[] resinterceptors = new HttpResponseInterceptor[resc];
        for (int i = 0; i < resc; i++) {
            resinterceptors[i] = proc.getResponseInterceptor(i);
        }
        protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors);
    }
    return protocolProcessor;
}

From source file:org.apache.http.impl.nio.client.AbstractHttpAsyncClient.java

private synchronized final HttpProcessor getProtocolProcessor() {
    if (this.protocolProcessor == null) {
        // Get mutable HTTP processor
        final BasicHttpProcessor proc = getHttpProcessor();
        // and upgrade an immutable copy of it
        final int reqc = proc.getRequestInterceptorCount();
        final HttpRequestInterceptor[] reqinterceptors = new HttpRequestInterceptor[reqc];
        for (int i = 0; i < reqc; i++) {
            reqinterceptors[i] = proc.getRequestInterceptor(i);
        }//from www .ja va 2s . com
        final int resc = proc.getResponseInterceptorCount();
        final HttpResponseInterceptor[] resinterceptors = new HttpResponseInterceptor[resc];
        for (int i = 0; i < resc; i++) {
            resinterceptors[i] = proc.getResponseInterceptor(i);
        }
        this.protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors);
    }
    return this.protocolProcessor;
}