to top
Android APIs
public final class

BasicHttpProcessor

extends Object
implements Cloneable HttpProcessor HttpRequestInterceptorList HttpResponseInterceptorList
java.lang.Object
   ↳ org.apache.http.protocol.BasicHttpProcessor

Class Overview

Keeps lists of interceptors for processing requests and responses.

Summary

Fields
protected List requestInterceptors
protected List responseInterceptors
Public Constructors
BasicHttpProcessor()
Public Methods
final void addInterceptor(HttpRequestInterceptor interceptor, int index)
final void addInterceptor(HttpResponseInterceptor interceptor, int index)
final void addInterceptor(HttpRequestInterceptor interceptor)
final void addInterceptor(HttpResponseInterceptor interceptor)
void addRequestInterceptor(HttpRequestInterceptor itcp, int index)
Inserts a request interceptor at the specified index.
void addRequestInterceptor(HttpRequestInterceptor itcp)
Appends a request interceptor to this list.
void addResponseInterceptor(HttpResponseInterceptor itcp, int index)
Inserts a response interceptor at the specified index.
void addResponseInterceptor(HttpResponseInterceptor itcp)
Appends a response interceptor to this list.
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()
Creates and returns a copy of this Object.
BasicHttpProcessor copy()
Creates a copy of this 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(HttpResponse response, HttpContext context)
Processes a response.
void process(HttpRequest request, HttpContext context)
Processes a request.
void removeRequestInterceptorByClass(Class clazz)
Removes all request interceptor of the specified class
void removeResponseInterceptorByClass(Class clazz)
Removes all response interceptor of the specified class
void setInterceptors(List list)
Sets the interceptor lists.
Protected Methods
void copyInterceptors(BasicHttpProcessor target)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.HttpRequestInterceptor
From interface org.apache.http.HttpResponseInterceptor
From interface org.apache.http.protocol.HttpRequestInterceptorList
From interface org.apache.http.protocol.HttpResponseInterceptorList

Fields

protected List requestInterceptors

Added in API level 1

protected List responseInterceptors

Added in API level 1

Public Constructors

public BasicHttpProcessor ()

Added in API level 1

Public Methods

public final void addInterceptor (HttpRequestInterceptor interceptor, int index)

Added in API level 1

public final void addInterceptor (HttpResponseInterceptor interceptor, int index)

Added in API level 1

public final void addInterceptor (HttpRequestInterceptor interceptor)

Added in API level 1
Parameters
interceptor the interceptor to add

public final void addInterceptor (HttpResponseInterceptor interceptor)

Added in API level 1
Parameters
interceptor the interceptor to add

public void addRequestInterceptor (HttpRequestInterceptor itcp, int index)

Added in API level 1

Inserts a request interceptor at the specified index.

Parameters
itcp the request interceptor to add
index the index to insert the interceptor at

public void addRequestInterceptor (HttpRequestInterceptor itcp)

Added in API level 1

Appends a request interceptor to this list.

Parameters
itcp the request interceptor to add

public void addResponseInterceptor (HttpResponseInterceptor itcp, int index)

Added in API level 1

Inserts a response interceptor at the specified index.

Parameters
itcp the response interceptor to add
index the index to insert the interceptor at

public void addResponseInterceptor (HttpResponseInterceptor itcp)

Added in API level 1

Appends a response interceptor to this list.

Parameters
itcp the response interceptor to add

public void clearInterceptors ()

Added in API level 1

Clears both interceptor lists maintained by this processor.

public void clearRequestInterceptors ()

Added in API level 1

Removes all request interceptors from this list.

public void clearResponseInterceptors ()

Added in API level 1

Removes all response interceptors from this list.

public Object clone ()

Added in API level 1

Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
  • a copy of this object.

public BasicHttpProcessor copy ()

Added in API level 1

Creates a copy of this instance

Returns
  • new instance of the BasicHttpProcessor

public HttpRequestInterceptor getRequestInterceptor (int index)

Added in API level 1

Obtains a request interceptor from this list.

Parameters
index the index of the interceptor to obtain, 0 for first
Returns
  • the interceptor at the given index, or null if the index is out of range

public int getRequestInterceptorCount ()

Added in API level 1

Obtains the current size of this list.

Returns
  • the number of request interceptors in this list

public HttpResponseInterceptor getResponseInterceptor (int index)

Added in API level 1

Obtains a response interceptor from this list.

Parameters
index the index of the interceptor to obtain, 0 for first
Returns
  • the interceptor at the given index, or null if the index is out of range

public int getResponseInterceptorCount ()

Added in API level 1

Obtains the current size of this list.

Returns
  • the number of response interceptors in this list

public void process (HttpResponse response, HttpContext context)

Added in API level 1

Processes a response. On the server side, this step is performed before the response is sent to the client. On the client side, this step is performed on incoming messages before the message body is evaluated.

Parameters
response the response to postprocess
context the context for the request

public void process (HttpRequest request, HttpContext context)

Added in API level 1

Processes a request. On the client side, this step is performed before the request is sent to the server. On the server side, this step is performed on incoming messages before the message body is evaluated.

Parameters
request the request to preprocess
context the context for the request

public void removeRequestInterceptorByClass (Class clazz)

Added in API level 1

Removes all request interceptor of the specified class

Parameters
clazz the class of the instances to be removed.

public void removeResponseInterceptorByClass (Class clazz)

Added in API level 1

Removes all response interceptor of the specified class

Parameters
clazz the class of the instances to be removed.

public void setInterceptors (List list)

Added in API level 1

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.

Parameters
list the list of request and response interceptors from which to initialize

Protected Methods

protected void copyInterceptors (BasicHttpProcessor target)

Added in API level 1