List of usage examples for org.apache.http.protocol BasicHttpProcessor getRequestInterceptor
public HttpRequestInterceptor getRequestInterceptor(int i)
From source file:org.jasig.apache.http.impl.client.ResponseHeaderHandlingHttpClient.java
/** * Override just to set RequestContent(true) *//*from www. ja v a2 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); }/*www .j a va 2 s . 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); }/* ww w.j a v a 2s .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 w w w . java 2 s . 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); } this.protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors); } return this.protocolProcessor; }