Methods Summary |
---|
public final void | addInterceptor(org.apache.http.HttpResponseInterceptor interceptor)Same as {@link #addResponseInterceptor(HttpResponseInterceptor) addResponseInterceptor}.
addResponseInterceptor(interceptor);
|
public final void | addInterceptor(org.apache.http.HttpResponseInterceptor interceptor, int index)
addResponseInterceptor(interceptor, index);
|
public final void | addInterceptor(org.apache.http.HttpRequestInterceptor interceptor)Same as {@link #addRequestInterceptor(HttpRequestInterceptor) addRequestInterceptor}.
addRequestInterceptor(interceptor);
|
public final void | addInterceptor(org.apache.http.HttpRequestInterceptor interceptor, int index)
addRequestInterceptor(interceptor, index);
|
public void | addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp)
// non-Javadoc, see interface HttpRequestInterceptorList
if (itcp == null) {
return;
}
if (this.requestInterceptors == null) {
this.requestInterceptors = new ArrayList();
}
this.requestInterceptors.add(itcp);
|
public void | addRequestInterceptor(org.apache.http.HttpRequestInterceptor itcp, int index)
if (index < 0) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
if (itcp == null) {
return;
}
if (this.requestInterceptors == null) {
if (index > 0) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
this.requestInterceptors = new ArrayList();
}
this.requestInterceptors.add(index, itcp);
|
public void | addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp)
if (itcp == null) {
return;
}
if (this.responseInterceptors == null) {
this.responseInterceptors = new ArrayList();
}
this.responseInterceptors.add(itcp);
|
public void | addResponseInterceptor(org.apache.http.HttpResponseInterceptor itcp, int index)
if (index < 0) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
if (itcp == null) {
return;
}
if (this.responseInterceptors == null) {
if (index > 0) {
throw new IndexOutOfBoundsException(String.valueOf(index));
}
this.responseInterceptors = new ArrayList();
}
this.responseInterceptors.add(index, itcp);
|
public void | clearInterceptors()Clears both interceptor lists maintained by this processor.
clearRequestInterceptors();
clearResponseInterceptors();
|
public void | clearRequestInterceptors()
this.requestInterceptors = null;
|
public void | clearResponseInterceptors()
this.responseInterceptors = null;
|
public java.lang.Object | clone()
BasicHttpProcessor clone = (BasicHttpProcessor) super.clone();
copyInterceptors(clone);
return clone;
|
public org.apache.http.protocol.BasicHttpProcessor | copy()Creates a copy of this instance
BasicHttpProcessor clone = new BasicHttpProcessor();
copyInterceptors(clone);
return clone;
|
protected void | copyInterceptors(org.apache.http.protocol.BasicHttpProcessor target)
if (this.requestInterceptors != null) {
target.requestInterceptors =
new ArrayList(this.requestInterceptors);
}
if (this.responseInterceptors != null) {
target.responseInterceptors =
new ArrayList(this.responseInterceptors);
}
|
public org.apache.http.HttpRequestInterceptor | getRequestInterceptor(int index)
if ((this.requestInterceptors == null) ||
(index < 0) || (index >= this.requestInterceptors.size()))
return null;
return (HttpRequestInterceptor) this.requestInterceptors.get(index);
|
public int | getRequestInterceptorCount()
return (this.requestInterceptors == null) ?
0 : this.requestInterceptors.size();
|
public org.apache.http.HttpResponseInterceptor | getResponseInterceptor(int index)
if ((this.responseInterceptors == null) ||
(index < 0) || (index >= this.responseInterceptors.size()))
return null;
return (HttpResponseInterceptor) this.responseInterceptors.get(index);
|
public int | getResponseInterceptorCount()
return (this.responseInterceptors == null) ?
0 : this.responseInterceptors.size();
|
public void | process(org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)
if (this.requestInterceptors != null) {
for (int i = 0; i < this.requestInterceptors.size(); i++) {
HttpRequestInterceptor interceptor =
(HttpRequestInterceptor) this.requestInterceptors.get(i);
interceptor.process(request, context);
}
}
|
public void | process(org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context)
if (this.responseInterceptors != null) {
for (int i = 0; i < this.responseInterceptors.size(); i++) {
HttpResponseInterceptor interceptor =
(HttpResponseInterceptor) this.responseInterceptors.get(i);
interceptor.process(response, context);
}
}
|
public void | removeRequestInterceptorByClass(java.lang.Class clazz)
if (this.requestInterceptors == null) {
return;
}
for (Iterator it = this.requestInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
it.remove();
}
}
|
public void | removeResponseInterceptorByClass(java.lang.Class clazz)
if (this.responseInterceptors == null) {
return;
}
for (Iterator it = this.responseInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
it.remove();
}
}
|
public void | setInterceptors(java.util.List list)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.
if (list == null) {
throw new IllegalArgumentException("List must not be null.");
}
if (this.requestInterceptors != null) {
this.requestInterceptors.clear();
}
if (this.responseInterceptors != null) {
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);
}
}
|