| java.lang.Object org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor
Constructor Summary | |
public | CommonsHttpInvokerRequestExecutor() Create a new CommonsHttpInvokerRequestExecutor with a default
HttpClient that uses a default MultiThreadedHttpConnectionManager. | public | CommonsHttpInvokerRequestExecutor(HttpClient httpClient) Create a new CommonsHttpInvokerRequestExecutor with the given
HttpClient instance. |
CommonsHttpInvokerRequestExecutor | public CommonsHttpInvokerRequestExecutor()(Code) | | Create a new CommonsHttpInvokerRequestExecutor with a default
HttpClient that uses a default MultiThreadedHttpConnectionManager.
See Also: org.apache.commons.httpclient.HttpClient See Also: org.apache.commons.httpclient.MultiThreadedHttpConnectionManager |
CommonsHttpInvokerRequestExecutor | public CommonsHttpInvokerRequestExecutor(HttpClient httpClient)(Code) | | Create a new CommonsHttpInvokerRequestExecutor with the given
HttpClient instance.
Parameters: httpClient - the HttpClient instance to use for this request executor |
createPostMethod | protected PostMethod createPostMethod(HttpInvokerClientConfiguration config) throws IOException(Code) | | Create a PostMethod for the given configuration.
The default implementation creates a standard PostMethod with
"application/x-java-serialized-object" as "Content-Type" header.
Parameters: config - the HTTP invoker configuration that specifies thetarget service the PostMethod instance throws: IOException - if thrown by I/O methods |
executePostMethod | protected void executePostMethod(HttpInvokerClientConfiguration config, HttpClient httpClient, PostMethod postMethod) throws IOException(Code) | | Execute the given PostMethod instance.
Parameters: config - the HTTP invoker configuration that specifies the target service Parameters: httpClient - the HttpClient to execute on Parameters: postMethod - the PostMethod to execute throws: IOException - if thrown by I/O methods See Also: org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HttpMethod) |
getHttpClient | public HttpClient getHttpClient()(Code) | | Return the HttpClient instance that this request executor uses.
|
getResponseBody | protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException(Code) | | Extract the response body from the given executed remote invocation
request.
The default implementation simply fetches the PostMethod's response
body stream. If the response is recognized as GZIP response, the
InputStream will get wrapped in a GZIPInputStream.
Parameters: config - the HTTP invoker configuration that specifies the target service Parameters: postMethod - the PostMethod to read the response body from an InputStream for the response body throws: IOException - if thrown by I/O methods See Also: CommonsHttpInvokerRequestExecutor.isGzipResponse See Also: java.util.zip.GZIPInputStream See Also: org.apache.commons.httpclient.methods.PostMethod.getResponseBodyAsStream See Also: org.apache.commons.httpclient.methods.PostMethod.getResponseHeader(String) |
isGzipResponse | protected boolean isGzipResponse(PostMethod postMethod)(Code) | | Determine whether the given response indicates a GZIP response.
Default implementation checks whether the HTTP "Content-Encoding"
header contains "gzip" (in any casing).
Parameters: postMethod - the PostMethod to check whether the given response indicates a GZIP response |
setHttpClient | public void setHttpClient(HttpClient httpClient)(Code) | | Set the HttpClient instance to use for this request executor.
|
setRequestBody | protected void setRequestBody(HttpInvokerClientConfiguration config, PostMethod postMethod, ByteArrayOutputStream baos) throws IOException(Code) | | Set the given serialized remote invocation as request body.
The default implementation simply sets the serialized invocation
as the PostMethod's request body. This can be overridden, for example,
to write a specific encoding and potentially set appropriate HTTP
request headers.
Parameters: config - the HTTP invoker configuration that specifies the target service Parameters: postMethod - the PostMethod to set the request body on Parameters: baos - the ByteArrayOutputStream that contains the serializedRemoteInvocation object throws: IOException - if thrown by I/O methods See Also: org.apache.commons.httpclient.methods.PostMethod.setRequestBody(java.io.InputStream) See Also: org.apache.commons.httpclient.methods.PostMethod.setRequestEntity See Also: org.apache.commons.httpclient.methods.InputStreamRequestEntity |
validateResponse | protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException(Code) | | Validate the given response as contained in the PostMethod object,
throwing an exception if it does not correspond to a successful HTTP response.
Default implementation rejects any HTTP status code beyond 2xx, to avoid
parsing the response body and trying to deserialize from a corrupted stream.
Parameters: config - the HTTP invoker configuration that specifies the target service Parameters: postMethod - the executed PostMethod to validate throws: IOException - if validation failed See Also: org.apache.commons.httpclient.methods.PostMethod.getStatusCode See Also: org.apache.commons.httpclient.HttpException |
|
|