public abstract class RemoteInvocationSerializingExporter extends RemoteInvocationBasedExporter implements InitializingBean
RemoteInvocation
objects and serialize
RemoteInvocationResult
objects,
for example Spring's HTTP invoker.
Provides template methods for ObjectInputStream
and
ObjectOutputStream
handling.
ObjectInputStream
,
ObjectOutputStream
,
doReadRemoteInvocation(java.io.ObjectInputStream)
,
doWriteRemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult, java.io.ObjectOutputStream)
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTENT_TYPE_SERIALIZED_OBJECT
Default content type: "application/x-java-serialized-object".
|
logger
Constructor and Description |
---|
RemoteInvocationSerializingExporter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
protected java.io.ObjectInputStream |
createObjectInputStream(java.io.InputStream is)
Create an ObjectInputStream for the given InputStream.
|
protected java.io.ObjectOutputStream |
createObjectOutputStream(java.io.OutputStream os)
Create an ObjectOutputStream for the given OutputStream.
|
protected RemoteInvocation |
doReadRemoteInvocation(java.io.ObjectInputStream ois)
Perform the actual reading of an invocation result object from the
given ObjectInputStream.
|
protected void |
doWriteRemoteInvocationResult(RemoteInvocationResult result,
java.io.ObjectOutputStream oos)
Perform the actual writing of the given invocation result object
to the given ObjectOutputStream.
|
java.lang.String |
getContentType()
Return the content type to use for sending remote invocation responses.
|
protected java.lang.Object |
getProxy() |
boolean |
isAcceptProxyClasses()
Return whether to accept deserialization of proxy classes.
|
void |
prepare()
Initialize this service exporter.
|
void |
setAcceptProxyClasses(boolean acceptProxyClasses)
Set whether to accept deserialization of proxy classes.
|
void |
setContentType(java.lang.String contentType)
Specify the content type to use for sending remote invocation responses.
|
getRemoteInvocationExecutor, invoke, invokeAndCreateResult, setRemoteInvocationExecutor
checkService, checkServiceInterface, getExporterName, getProxyForService, getService, getServiceInterface, setInterceptors, setRegisterTraceInterceptor, setService, setServiceInterface
getBeanClassLoader, overrideThreadContextClassLoader, resetThreadContextClassLoader, setBeanClassLoader
public static final java.lang.String CONTENT_TYPE_SERIALIZED_OBJECT
public void setContentType(java.lang.String contentType)
Default is "application/x-java-serialized-object".
public java.lang.String getContentType()
public void setAcceptProxyClasses(boolean acceptProxyClasses)
Default is "true". May be deactivated as a security measure.
public boolean isAcceptProxyClasses()
public void afterPropertiesSet()
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, ApplicationContextAware
etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
afterPropertiesSet
in interface InitializingBean
public void prepare()
protected final java.lang.Object getProxy()
protected java.io.ObjectInputStream createObjectInputStream(java.io.InputStream is) throws java.io.IOException
The default implementation creates a Spring CodebaseAwareObjectInputStream
.
is
- the InputStream to read fromjava.io.IOException
- if creation of the ObjectInputStream failedprotected RemoteInvocation doReadRemoteInvocation(java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException
The default implementation simply calls
ObjectInputStream.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 fromjava.io.IOException
- in case of I/O failurejava.lang.ClassNotFoundException
- if case of a transferred class not
being found in the local ClassLoaderprotected java.io.ObjectOutputStream createObjectOutputStream(java.io.OutputStream os) throws java.io.IOException
The default implementation creates a plain
ObjectOutputStream
.
os
- the OutputStream to write tojava.io.IOException
- if creation of the ObjectOutputStream failedprotected void doWriteRemoteInvocationResult(RemoteInvocationResult result, java.io.ObjectOutputStream oos) throws java.io.IOException
The default implementation simply calls
ObjectOutputStream.writeObject(java.lang.Object)
.
Can be overridden for serialization of a custom wrapper object rather
than the plain invocation, for example an encryption-aware holder.
result
- the RemoteInvocationResult objectoos
- the ObjectOutputStream to write tojava.io.IOException
- if thrown by I/O methods