List of usage examples for org.apache.http.protocol BasicHttpProcessor getRequestInterceptorCount
public int getRequestInterceptorCount()
From source file:org.jasig.apache.http.impl.client.ResponseHeaderHandlingHttpClient.java
/** * Override just to set RequestContent(true) *///from w w w.j a v a 2 s . c o m @Override protected BasicHttpProcessor createHttpProcessor() { final BasicHttpProcessor parentHttpProcessor = super.createHttpProcessor(); for (int i = 0; i < parentHttpProcessor.getRequestInterceptorCount(); i++) { final HttpRequestInterceptor requestInterceptor = parentHttpProcessor.getRequestInterceptor(i); //Replace the existing RequestContent interceptor with a version that sets overwrite=true if (requestInterceptor instanceof RequestContent) { parentHttpProcessor.removeRequestInterceptorByClass(RequestContent.class); parentHttpProcessor.addInterceptor(new RequestContent(true), i); break; } } return parentHttpProcessor; }
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); }//w w w . j av a2s. c o 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); }// w w w .jav a 2s . com 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 w w w .j a v a 2 s .c om*/ 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; }