|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.protocol.HttpRequestExecutor
@Contract(threading=IMMUTABLE) public class HttpRequestExecutor
HttpRequestExecutor
is a client side HTTP protocol handler based
on the blocking (classic) I/O model.
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.
Field Summary | |
---|---|
static int |
DEFAULT_WAIT_FOR_CONTINUE
|
Constructor Summary | |
---|---|
HttpRequestExecutor()
|
|
HttpRequestExecutor(int waitForContinue)
Creates new instance of HttpRequestExecutor. |
Method Summary | |
---|---|
protected boolean |
canResponseHaveBody(HttpRequest request,
HttpResponse response)
Decide whether a response comes with an entity. |
protected HttpResponse |
doReceiveResponse(HttpRequest request,
HttpClientConnection conn,
HttpContext context)
Waits for and receives a response. |
protected HttpResponse |
doSendRequest(HttpRequest request,
HttpClientConnection conn,
HttpContext context)
Send the given request over the given connection. |
HttpResponse |
execute(HttpRequest request,
HttpClientConnection conn,
HttpContext context)
Sends the request and obtain a response. |
void |
postProcess(HttpResponse response,
HttpProcessor processor,
HttpContext context)
Post-processes the given response using the given protocol processor and completes the process of request execution. |
void |
preProcess(HttpRequest request,
HttpProcessor processor,
HttpContext context)
Pre-process the given request using the given protocol processor and initiates the process of request execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_WAIT_FOR_CONTINUE
Constructor Detail |
---|
public HttpRequestExecutor(int waitForContinue)
public HttpRequestExecutor()
Method Detail |
---|
protected boolean canResponseHaveBody(HttpRequest request, HttpResponse response)
Derived executors can override this method to handle methods and response codes not specified in RFC 2616.
request
- the request, to obtain the executed methodresponse
- the response, to obtain the status codepublic HttpResponse execute(HttpRequest request, HttpClientConnection conn, HttpContext context) throws IOException, HttpException
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.public void preProcess(HttpRequest request, HttpProcessor processor, HttpContext context) throws HttpException, IOException
request
- the request to prepareprocessor
- the processor to usecontext
- 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.protected HttpResponse doSendRequest(HttpRequest request, HttpClientConnection conn, HttpContext context) throws IOException, HttpException
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 establishedcontext
- the context for sending the request
null
if the expect-continue handshake is not used
IOException
- in case of an I/O error.
HttpException
- in case of HTTP protocol violation or a processing
problem.protected HttpResponse doReceiveResponse(HttpRequest request, HttpClientConnection conn, HttpContext context) throws HttpException, IOException
request
- the request for which to obtain the responseconn
- the connection over which the request was sentcontext
- 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.public void postProcess(HttpResponse response, HttpProcessor processor, HttpContext context) throws HttpException, IOException
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
EntityUtils.consume(org.apache.http.HttpEntity)
has been invoked.
response
- the response object to post-processprocessor
- the processor to usecontext
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |