Method from org.apache.http.protocol.BasicHttpProcessor Detail: |
public final void addInterceptor(HttpRequestInterceptor interceptor) {
addRequestInterceptor(interceptor);
}
|
public final void addInterceptor(HttpResponseInterceptor interceptor) {
addResponseInterceptor(interceptor);
}
|
public final void addInterceptor(HttpRequestInterceptor interceptor,
int index) {
addRequestInterceptor(interceptor, index);
}
|
public final void addInterceptor(HttpResponseInterceptor interceptor,
int index) {
addResponseInterceptor(interceptor, index);
}
|
public void addRequestInterceptor(HttpRequestInterceptor itcp) {
if (itcp == null) {
return;
}
this.requestInterceptors.add(itcp);
}
|
public void addRequestInterceptor(HttpRequestInterceptor itcp,
int index) {
if (itcp == null) {
return;
}
this.requestInterceptors.add(index, itcp);
}
|
public void addResponseInterceptor(HttpResponseInterceptor itcp) {
if (itcp == null) {
return;
}
this.responseInterceptors.add(itcp);
}
|
public void addResponseInterceptor(HttpResponseInterceptor itcp,
int index) {
if (itcp == null) {
return;
}
this.responseInterceptors.add(index, itcp);
}
|
public void clearInterceptors() {
clearRequestInterceptors();
clearResponseInterceptors();
}
Clears both interceptor lists maintained by this processor. |
public void clearRequestInterceptors() {
this.requestInterceptors.clear();
}
|
public void clearResponseInterceptors() {
this.responseInterceptors.clear();
}
|
public Object clone() throws CloneNotSupportedException {
BasicHttpProcessor clone = (BasicHttpProcessor) super.clone();
copyInterceptors(clone);
return clone;
}
|
public BasicHttpProcessor copy() {
BasicHttpProcessor clone = new BasicHttpProcessor();
copyInterceptors(clone);
return clone;
}
Creates a copy of this instance |
protected void copyInterceptors(BasicHttpProcessor target) {
target.requestInterceptors.clear();
target.requestInterceptors.addAll(this.requestInterceptors);
target.responseInterceptors.clear();
target.responseInterceptors.addAll(this.responseInterceptors);
}
Sets up the target to have the same list of interceptors
as the current instance. |
public HttpRequestInterceptor getRequestInterceptor(int index) {
if ((index < 0) || (index >= this.requestInterceptors.size()))
return null;
return (HttpRequestInterceptor) this.requestInterceptors.get(index);
}
|
public int getRequestInterceptorCount() {
return this.requestInterceptors.size();
}
|
public HttpResponseInterceptor getResponseInterceptor(int index) {
if ((index < 0) || (index >= this.responseInterceptors.size()))
return null;
return (HttpResponseInterceptor) this.responseInterceptors.get(index);
}
|
public int getResponseInterceptorCount() {
return this.responseInterceptors.size();
}
|
public void process(HttpRequest request,
HttpContext context) throws IOException, HttpException {
for (int i = 0; i < this.requestInterceptors.size(); i++) {
HttpRequestInterceptor interceptor =
(HttpRequestInterceptor) this.requestInterceptors.get(i);
interceptor.process(request, context);
}
}
|
public void process(HttpResponse response,
HttpContext context) throws IOException, HttpException {
for (int i = 0; i < this.responseInterceptors.size(); i++) {
HttpResponseInterceptor interceptor =
(HttpResponseInterceptor) this.responseInterceptors.get(i);
interceptor.process(response, context);
}
}
|
public void removeRequestInterceptorByClass(Class clazz) {
for (Iterator it = this.requestInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
it.remove();
}
}
}
|
public void removeResponseInterceptorByClass(Class clazz) {
for (Iterator it = this.responseInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
it.remove();
}
}
}
|
public void setInterceptors(List list) {
if (list == null) {
throw new IllegalArgumentException("List must not be null.");
}
this.requestInterceptors.clear();
this.responseInterceptors.clear();
for (int i = 0; i < list.size(); i++) {
Object obj = list.get(i);
if (obj instanceof HttpRequestInterceptor) {
addInterceptor((HttpRequestInterceptor)obj);
}
if (obj instanceof HttpResponseInterceptor) {
addInterceptor((HttpResponseInterceptor)obj);
}
}
}
Sets the interceptor lists.
First, both interceptor lists maintained by this processor
will be cleared.
Subsequently,
elements of the argument list that are request interceptors will be
added to the request interceptor list.
Elements that are response interceptors will be
added to the response interceptor list.
Elements that are both request and response interceptor will be
added to both lists.
Elements that are neither request nor response interceptor
will be ignored. |