java.lang.Object | |
↳ | org.apache.http.protocol.HttpRequestExecutor |
HttpRequestExecutor is a client side HTTP protocol handler based on the
blocking I/O model that implements the essential requirements of the HTTP
protocol for the client side message processing, as described by RFC 2616.
HttpRequestExecutor relies on HttpProcessor
to generate mandatory
protocol headers for all outgoing messages and apply common, cross-cutting
message transformations to all incoming and outgoing messages. Application
specific processing can be implemented outside HttpRequestExecutor once the
request has been executed and a response has been received.
The following parameters can be used to customize the behavior of this class:
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new request executor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sends the request and obtain a response.
| |||||||||||
Post-processes the given response using the given protocol processor and
completes the process of request execution.
| |||||||||||
Pre-process the given request using the given protocol processor and
initiates the process of request execution.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Decide whether a response comes with an entity.
| |||||||||||
Waits for and receives a response.
| |||||||||||
Send the given request over the given connection.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Create a new request executor.
Sends the request and obtain a response.
request | the request to execute. |
---|---|
conn | the connection over which to execute the request. |
IOException | in case of an I/O error. |
---|---|
HttpException | in case of HTTP protocol violation or a processing problem. |
Post-processes the given response using the given protocol processor and completes the process of request execution.
This method does not read the response entity, if any.
The connection over which content of the response entity is being
streamed from cannot be reused until consumeContent()
has been invoked.
response | the response object to post-process |
---|---|
processor | the processor to use |
context | the context for post-processing the response |
IOException | in case of an I/O error. |
---|---|
HttpException | in case of HTTP protocol violation or a processing problem. |
Pre-process the given request using the given protocol processor and initiates the process of request execution.
request | the request to prepare |
---|---|
processor | the processor to use |
context | the context for sending the request |
IOException | in case of an I/O error. |
---|---|
HttpException | in case of HTTP protocol violation or a processing problem. |
Decide whether a response comes with an entity.
The implementation in this class is based on RFC 2616.
Derived executors can override this method to handle
methods and response codes not specified in RFC 2616.
request | the request, to obtain the executed method |
---|---|
response | the response, to obtain the status code |
Waits for and receives a response. This method will automatically ignore intermediate responses with status code 1xx.
request | the request for which to obtain the response |
---|---|
conn | the connection over which the request was sent |
context | the context for receiving the response |
IOException | in case of an I/O error. |
---|---|
HttpException | in case of HTTP protocol violation or a processing problem. |
Send the given request over the given connection.
This method also handles the expect-continue handshake if necessary. If it does not have to handle an expect-continue handshake, it will not use the connection for reading or anything else that depends on data coming in over the connection.
request | the request to send, already
preprocessed |
---|---|
conn | the connection over which to send the request, already established |
context | the context for sending the request |
null
if the expect-continue handshake is not usedIOException | in case of an I/O error. |
---|---|
HttpException | in case of HTTP protocol violation or a processing problem. |