Package org.apache.http.protocol
Class HttpRequestExecutor
- java.lang.Object
-
- org.apache.http.protocol.HttpRequestExecutor
-
@Contract(threading=IMMUTABLE) public class HttpRequestExecutor extends java.lang.Object
HttpRequestExecutor
is a client side HTTP protocol handler based on the blocking (classic) I/O model.HttpRequestExecutor
relies onHttpProcessor
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 outsideHttpRequestExecutor
once the request has been executed and a response has been received.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_WAIT_FOR_CONTINUE
-
Constructor Summary
Constructors Constructor Description HttpRequestExecutor()
HttpRequestExecutor(int waitForContinue)
Creates new instance of HttpRequestExecutor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
DEFAULT_WAIT_FOR_CONTINUE
public static final int DEFAULT_WAIT_FOR_CONTINUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public HttpResponse execute(HttpRequest request, HttpClientConnection conn, HttpContext context) throws java.io.IOException, HttpException
Sends the request and obtain a response.- Parameters:
request
- the request to execute.conn
- the connection over which to execute the request.- Returns:
- the response to the request.
- Throws:
java.io.IOException
- in case of an I/O error.HttpException
- in case of HTTP protocol violation or a processing problem.
-
preProcess
public void preProcess(HttpRequest request, HttpProcessor processor, HttpContext context) throws HttpException, java.io.IOException
Pre-process the given request using the given protocol processor and initiates the process of request execution.- Parameters:
request
- the request to prepareprocessor
- the processor to usecontext
- the context for sending the request- Throws:
java.io.IOException
- in case of an I/O error.HttpException
- in case of HTTP protocol violation or a processing problem.
-
postProcess
public void postProcess(HttpResponse response, HttpProcessor processor, HttpContext context) throws HttpException, java.io.IOException
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
EntityUtils.consume(org.apache.http.HttpEntity)
has been invoked.- Parameters:
response
- the response object to post-processprocessor
- the processor to usecontext
- the context for post-processing the response- Throws:
java.io.IOException
- in case of an I/O error.HttpException
- in case of HTTP protocol violation or a processing problem.
-
-