java.lang.Object | ||
↳ | org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor | |
↳ | org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor |
HttpInvokerRequestExecutor implementation that uses standard J2SE facilities to execute POST requests, without support for HTTP authentication or advanced configuration options.
Designed for easy subclassing, customizing specific template methods. However, consider CommonsHttpInvokerRequestExecutor for more sophisticated needs: The J2SE HttpURLConnection is rather limited in its capabilities.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Execute the given request through a standard J2SE HttpURLConnection.
| |||||||||||
Determine whether the given response is a GZIP response.
| |||||||||||
Open an HttpURLConnection for the given remote invocation request.
| |||||||||||
Prepare the given HTTP connection.
| |||||||||||
Extract the response body from the given executed remote invocation
request.
| |||||||||||
Validate the given response as contained in the HttpURLConnection object,
throwing an exception if it does not correspond to a successful HTTP response.
| |||||||||||
Set the given serialized remote invocation as request body.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanClassLoaderAware
| |||||||||||
From interface
org.springframework.remoting.httpinvoker.HttpInvokerRequestExecutor
|
Execute the given request through a standard J2SE HttpURLConnection.
This method implements the basic processing workflow: The actual work happens in this class's template methods.
config | the HTTP invoker configuration that specifies the target service |
---|---|
baos | the ByteArrayOutputStream that contains the serialized RemoteInvocation object |
openConnection(HttpInvokerClientConfiguration)
prepareConnection(HttpURLConnection, int)
writeRequestBody(HttpInvokerClientConfiguration, HttpURLConnection, ByteArrayOutputStream)
validateResponse(HttpInvokerClientConfiguration, HttpURLConnection)
readResponseBody(HttpInvokerClientConfiguration, HttpURLConnection)
Determine whether the given response is a GZIP response.
Default implementation checks whether the HTTP "Content-Encoding" header contains "gzip" (in any casing).
con | the HttpURLConnection to check |
---|
Open an HttpURLConnection for the given remote invocation request.
config | the HTTP invoker configuration that specifies the target service |
---|
IOException | if thrown by I/O methods |
---|
Prepare the given HTTP connection.
The default implementation specifies POST as method, "application/x-java-serialized-object" as "Content-Type" header, and the given content length as "Content-Length" header.
con | the HTTP connection to prepare |
---|---|
contentLength | the length of the content to send |
IOException | if thrown by HttpURLConnection methods |
---|
Extract the response body from the given executed remote invocation request.
The default implementation simply reads the serialized invocation from the HttpURLConnection's InputStream. If the response is recognized as GZIP response, the InputStream will get wrapped in a GZIPInputStream.
config | the HTTP invoker configuration that specifies the target service |
---|---|
con | the HttpURLConnection to read the response body from |
IOException | if thrown by I/O methods |
---|
isGzipResponse(HttpURLConnection)
getInputStream()
getHeaderField(int)
getHeaderFieldKey(int)
Validate the given response as contained in the HttpURLConnection 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.
config | the HTTP invoker configuration that specifies the target service |
---|---|
con | the HttpURLConnection to validate |
IOException | if validation failed |
---|
Set the given serialized remote invocation as request body.
The default implementation simply write the serialized invocation to the HttpURLConnection's OutputStream. This can be overridden, for example, to write a specific encoding and potentially set appropriate HTTP request headers.
config | the HTTP invoker configuration that specifies the target service |
---|---|
con | the HttpURLConnection to write the request body to |
baos | the ByteArrayOutputStream that contains the serialized RemoteInvocation object |
IOException | if thrown by I/O methods |
---|