@NotThreadSafe public final class BasicHttpProcessor extends Object implements HttpProcessor, HttpRequestInterceptorList, HttpResponseInterceptorList, Cloneable
HttpProcessor.
Please note access to the internal structures of this class is not synchronized and therefore this class may be thread-unsafe.
| Modifier and Type | Field and Description |
|---|---|
protected List<HttpRequestInterceptor> |
requestInterceptors |
protected List<HttpResponseInterceptor> |
responseInterceptors |
| Constructor and Description |
|---|
BasicHttpProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(HttpRequestInterceptor interceptor) |
void |
addInterceptor(HttpRequestInterceptor interceptor,
int index) |
void |
addInterceptor(HttpResponseInterceptor interceptor) |
void |
addInterceptor(HttpResponseInterceptor interceptor,
int index) |
void |
addRequestInterceptor(HttpRequestInterceptor itcp)
Appends a request interceptor to this list.
|
void |
addRequestInterceptor(HttpRequestInterceptor itcp,
int index)
Inserts a request interceptor at the specified index.
|
void |
addResponseInterceptor(HttpResponseInterceptor itcp)
Appends a response interceptor to this list.
|
void |
addResponseInterceptor(HttpResponseInterceptor itcp,
int index)
Inserts a response interceptor at the specified index.
|
void |
clearInterceptors()
Clears both interceptor lists maintained by this processor.
|
void |
clearRequestInterceptors()
Removes all request interceptors from this list.
|
void |
clearResponseInterceptors()
Removes all response interceptors from this list.
|
Object |
clone() |
BasicHttpProcessor |
copy()
Creates a copy of this instance
|
protected void |
copyInterceptors(BasicHttpProcessor target)
Sets up the target to have the same list of interceptors
as the current instance.
|
HttpRequestInterceptor |
getRequestInterceptor(int index)
Obtains a request interceptor from this list.
|
int |
getRequestInterceptorCount()
Obtains the current size of this list.
|
HttpResponseInterceptor |
getResponseInterceptor(int index)
Obtains a response interceptor from this list.
|
int |
getResponseInterceptorCount()
Obtains the current size of this list.
|
void |
process(HttpRequest request,
HttpContext context)
Processes a request.
|
void |
process(HttpResponse response,
HttpContext context)
Processes a response.
|
void |
removeRequestInterceptorByClass(Class<? extends HttpRequestInterceptor> clazz)
Removes all request interceptor of the specified class
|
void |
removeResponseInterceptorByClass(Class<? extends HttpResponseInterceptor> clazz)
Removes all response interceptor of the specified class
|
void |
setInterceptors(List<?> list)
Sets the interceptor lists.
|
protected final List<HttpRequestInterceptor> requestInterceptors
protected final List<HttpResponseInterceptor> responseInterceptors
public void addRequestInterceptor(HttpRequestInterceptor itcp)
HttpRequestInterceptorListaddRequestInterceptor in interface HttpRequestInterceptorListitcp - the request interceptor to addpublic void addRequestInterceptor(HttpRequestInterceptor itcp, int index)
HttpRequestInterceptorListaddRequestInterceptor in interface HttpRequestInterceptorListitcp - the request interceptor to addindex - the index to insert the interceptor atpublic void addResponseInterceptor(HttpResponseInterceptor itcp, int index)
HttpResponseInterceptorListaddResponseInterceptor in interface HttpResponseInterceptorListitcp - the response interceptor to addindex - the index to insert the interceptor atpublic void removeRequestInterceptorByClass(Class<? extends HttpRequestInterceptor> clazz)
HttpRequestInterceptorListremoveRequestInterceptorByClass in interface HttpRequestInterceptorListclazz - the class of the instances to be removed.public void removeResponseInterceptorByClass(Class<? extends HttpResponseInterceptor> clazz)
HttpResponseInterceptorListremoveResponseInterceptorByClass in interface HttpResponseInterceptorListclazz - the class of the instances to be removed.public final void addInterceptor(HttpRequestInterceptor interceptor)
public final void addInterceptor(HttpRequestInterceptor interceptor, int index)
public int getRequestInterceptorCount()
HttpRequestInterceptorListgetRequestInterceptorCount in interface HttpRequestInterceptorListpublic HttpRequestInterceptor getRequestInterceptor(int index)
HttpRequestInterceptorListgetRequestInterceptor in interface HttpRequestInterceptorListindex - the index of the interceptor to obtain,
0 for firstnull if the index is out of rangepublic void clearRequestInterceptors()
HttpRequestInterceptorListclearRequestInterceptors in interface HttpRequestInterceptorListpublic void addResponseInterceptor(HttpResponseInterceptor itcp)
HttpResponseInterceptorListaddResponseInterceptor in interface HttpResponseInterceptorListitcp - the response interceptor to addpublic final void addInterceptor(HttpResponseInterceptor interceptor)
public final void addInterceptor(HttpResponseInterceptor interceptor, int index)
public int getResponseInterceptorCount()
HttpResponseInterceptorListgetResponseInterceptorCount in interface HttpResponseInterceptorListpublic HttpResponseInterceptor getResponseInterceptor(int index)
HttpResponseInterceptorListgetResponseInterceptor in interface HttpResponseInterceptorListindex - the index of the interceptor to obtain,
0 for firstnull if the index is out of rangepublic void clearResponseInterceptors()
HttpResponseInterceptorListclearResponseInterceptors in interface HttpResponseInterceptorListpublic void setInterceptors(List<?> list)
setInterceptors in interface HttpRequestInterceptorListsetInterceptors in interface HttpResponseInterceptorListlist - the list of request and response interceptors
from which to initializepublic void clearInterceptors()
public void process(HttpRequest request, HttpContext context) throws IOException, HttpException
HttpRequestInterceptorprocess in interface HttpRequestInterceptorrequest - the request to preprocesscontext - the context for the requestIOException - in case of an I/O errorHttpException - in case of an HTTP protocol violationpublic void process(HttpResponse response, HttpContext context) throws IOException, HttpException
HttpResponseInterceptorprocess in interface HttpResponseInterceptorresponse - the response to postprocesscontext - the context for the requestIOException - in case of an I/O errorHttpException - in case of an HTTP protocol violationprotected void copyInterceptors(BasicHttpProcessor target)
target - object to be initialisedpublic BasicHttpProcessor copy()
public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright © 2005–2013 The Apache Software Foundation. All rights reserved.