|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
public abstract class AbstractHttpInvokerRequestExecutor
Abstract base implementation of the HttpInvokerRequestExecutor interface.
Pre-implements serialization of RemoteInvocation objects and deserialization of RemoteInvocationResults objects.
doExecuteRequest(org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration, java.io.ByteArrayOutputStream)
Field Summary | |
---|---|
protected static String |
CONTENT_TYPE_SERIALIZED_OBJECT
|
protected static String |
HTTP_HEADER_CONTENT_LENGTH
|
protected static String |
HTTP_HEADER_CONTENT_TYPE
|
protected static String |
HTTP_METHOD_POST
|
protected Log |
logger
|
Constructor Summary | |
---|---|
AbstractHttpInvokerRequestExecutor()
|
Method Summary | |
---|---|
protected ObjectInputStream |
createObjectInputStream(InputStream is,
String codebaseUrl)
Create an ObjectInputStream for the given InputStream and codebase. |
protected InputStream |
decorateInputStream(InputStream is)
Return the InputStream to use for reading remote invocation results, potentially decorating the given original InputStream. |
protected OutputStream |
decorateOutputStream(OutputStream os)
Return the OutputStream to use for writing remote invocations, potentially decorating the given original OutputStream. |
protected abstract RemoteInvocationResult |
doExecuteRequest(HttpInvokerClientConfiguration config,
ByteArrayOutputStream baos)
Execute a request to send the given serialized remote invocation. |
protected RemoteInvocationResult |
doReadRemoteInvocationResult(ObjectInputStream ois)
Perform the actual reading of an invocation object from the given ObjectInputStream. |
protected void |
doWriteRemoteInvocation(RemoteInvocation invocation,
ObjectOutputStream oos)
Perform the actual writing of the given invocation object to the given ObjectOutputStream. |
RemoteInvocationResult |
executeRequest(HttpInvokerClientConfiguration config,
RemoteInvocation invocation)
Execute a request to send the given remote invocation. |
protected ByteArrayOutputStream |
getByteArrayOutputStream(RemoteInvocation invocation)
Serialize the given RemoteInvocation into a ByteArrayOutputStream. |
protected RemoteInvocationResult |
readRemoteInvocationResult(InputStream is,
String codebaseUrl)
Deserialize a RemoteInvocationResult object from the given InputStream. |
protected void |
writeRemoteInvocation(RemoteInvocation invocation,
OutputStream os)
Serialize the given RemoteInvocation to the given OutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String CONTENT_TYPE_SERIALIZED_OBJECT
protected static final String HTTP_HEADER_CONTENT_TYPE
protected static final String HTTP_HEADER_CONTENT_LENGTH
protected static final String HTTP_METHOD_POST
protected final Log logger
Constructor Detail |
---|
public AbstractHttpInvokerRequestExecutor()
Method Detail |
---|
public final RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation) throws IOException, ClassNotFoundException
HttpInvokerRequestExecutor
executeRequest
in interface HttpInvokerRequestExecutor
config
- the HTTP invoker configuration that specifies the
target serviceinvocation
- the RemoteInvocation to execute
IOException
- if thrown by I/O operations
ClassNotFoundException
- if thrown during deserializationprotected ByteArrayOutputStream getByteArrayOutputStream(RemoteInvocation invocation) throws IOException
invocation
- the RemoteInvocation object
IOException
- if thrown by I/O methodsprotected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException
The default implementation gives decorateOutputStream
a chance
to decorate the stream first (for example, for custom encryption or compression).
Creates an ObjectOutputStream
for the final stream and calls
doWriteRemoteInvocation
to actually write the object.
Can be overridden for custom serialization of the invocation.
invocation
- the RemoteInvocation objectos
- the OutputStream to write to
IOException
- if thrown by I/O methodsdecorateOutputStream(java.io.OutputStream)
,
doWriteRemoteInvocation(org.springframework.remoting.support.RemoteInvocation, java.io.ObjectOutputStream)
protected OutputStream decorateOutputStream(OutputStream os) throws IOException
The default implementation returns the given stream as-is. Can be overridden, for example, for custom encryption or compression.
os
- the original OutputStream
IOException
protected void doWriteRemoteInvocation(RemoteInvocation invocation, ObjectOutputStream oos) throws IOException
The default implementation simply calls writeObject
.
Can be overridden for serialization of a custom wrapper object rather
than the plain invocation, for example an encryption-aware holder.
invocation
- the RemoteInvocation objectoos
- the ObjectOutputStream to write to
IOException
- if thrown by I/O methodsObjectOutputStream.writeObject(java.lang.Object)
protected abstract RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws IOException, ClassNotFoundException
Implementations will usually call readRemoteInvocationResult
to deserialize a returned RemoteInvocationResult object.
config
- the HTTP invoker configuration that specifies the
target servicebaos
- the ByteArrayOutputStream that contains the serialized
RemoteInvocation object
IOException
- if thrown by I/O operations
ClassNotFoundException
- if thrown during deserializationreadRemoteInvocationResult(java.io.InputStream, String)
protected RemoteInvocationResult readRemoteInvocationResult(InputStream is, String codebaseUrl) throws IOException, ClassNotFoundException
Gives decorateInputStream
a chance to decorate the stream
first (for example, for custom encryption or compression). Creates an
ObjectInputStream
via createObjectInputStream
and
calls doReadRemoteInvocationResult
to actually read the object.
Can be overridden for custom serialization of the invocation.
is
- the InputStream to read fromcodebaseUrl
- the codebase URL to load classes from if not found locally
IOException
- if thrown by I/O methods
ClassNotFoundException
- if thrown during deserializationdecorateInputStream(java.io.InputStream)
,
createObjectInputStream(java.io.InputStream, java.lang.String)
,
doReadRemoteInvocationResult(java.io.ObjectInputStream)
protected InputStream decorateInputStream(InputStream is) throws IOException
The default implementation returns the given stream as-is. Can be overridden, for example, for custom encryption or compression.
is
- the original InputStream
IOException
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException
Spring's CodebaseAwareObjectInputStream is not only used for loading from a specified codebase, but also to explicitly resolve primitive class names. This is done by the standard ObjectInputStream on JDK 1.4+, but needs to be done explicitly on JDK 1.3.
is
- the InputStream to read fromcodebaseUrl
- the codebase URL to load classes from if not found locally
(can be null
)
IOException
- if creation of the ObjectInputStream failedCodebaseAwareObjectInputStream
protected RemoteInvocationResult doReadRemoteInvocationResult(ObjectInputStream ois) throws IOException, ClassNotFoundException
The default implementation simply calls readObject
.
Can be overridden for deserialization of a custom wrapper object rather
than the plain invocation, for example an encryption-aware holder.
ois
- the ObjectInputStream to read from
IOException
- if thrown by I/O methods
ClassNotFoundException
ObjectOutputStream.writeObject(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |