org.springframework.remoting.rmi

## 类 RemoteInvocationSerializingExporter

- java.lang.Object
- - org.springframework.remoting.support.RemotingSupport
  - - org.springframework.remoting.support.RemoteExporter
    - - org.springframework.remoting.support.RemoteInvocationBasedExporter
      - - org.springframework.remoting.rmi.RemoteInvocationSerializingExporter

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.InitializingBean

      public abstract class RemoteInvocationSerializingExporter
      extends RemoteInvocationBasedExporter
      implements org.springframework.beans.factory.InitializingBean

  Abstract base class for remote service exporters that explicitly deserialize `RemoteInvocation` objects and serialize `RemoteInvocationResult` objects, for example Spring's HTTP invoker.

  Provides template methods for `ObjectInputStream` and `ObjectOutputStream` handling.

  从以下版本开始:
    2.5.1
  作者:
    Juergen Hoeller
  另请参阅:
    `ObjectInputStream`, `ObjectOutputStream`, `doReadRemoteInvocation(java.io.ObjectInputStream)`, `doWriteRemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult, java.io.ObjectOutputStream)`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `CONTENT_TYPE_SERIALIZED_OBJECT` Default content type: "application/x-java-serialized-object"

    - ### 从类继承的字段 org.springframework.remoting.support.RemotingSupport

      `logger`

  - ### 构造器概要

    构造器
    构造器和说明
    `RemoteInvocationSerializingExporter()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `afterPropertiesSet()`
    `protected ObjectInputStream` | `createObjectInputStream(InputStream is)` Create an ObjectInputStream for the given InputStream.
    `protected ObjectOutputStream` | `createObjectOutputStream(OutputStream os)` Create an ObjectOutputStream for the given OutputStream.
    `protected RemoteInvocation` | `doReadRemoteInvocation(ObjectInputStream ois)` Perform the actual reading of an invocation result object from the given ObjectInputStream.
    `protected void` | `doWriteRemoteInvocationResult(RemoteInvocationResult result, ObjectOutputStream oos)` Perform the actual writing of the given invocation result object to the given ObjectOutputStream.
    `String` | `getContentType()` Return the content type to use for sending remote invocation responses.
    `protected 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(String contentType)` Specify the content type to use for sending remote invocation responses.

    - ### 从类继承的方法 org.springframework.remoting.support.RemoteInvocationBasedExporter

      `getRemoteInvocationExecutor, invoke, invokeAndCreateResult, setRemoteInvocationExecutor`

    - ### 从类继承的方法 org.springframework.remoting.support.RemoteExporter

      `checkService, checkServiceInterface, getExporterName, getProxyForService, getService, getServiceInterface, setInterceptors, setRegisterTraceInterceptor, setService, setServiceInterface`

    - ### 从类继承的方法 org.springframework.remoting.support.RemotingSupport

      `getBeanClassLoader, overrideThreadContextClassLoader, resetThreadContextClassLoader, setBeanClassLoader`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### CONTENT_TYPE_SERIALIZED_OBJECT

          public static final String CONTENT_TYPE_SERIALIZED_OBJECT

      Default content type: "application/x-java-serialized-object"
      另请参阅:
        常量字段值

  - ### 构造器详细资料

    - #### RemoteInvocationSerializingExporter

          public RemoteInvocationSerializingExporter()

  - ### 方法详细资料

    - #### setContentType

          public void setContentType(String contentType)

      Specify the content type to use for sending remote invocation responses.

      Default is "application/x-java-serialized-object".

    - #### getContentType

          public String getContentType()

      Return the content type to use for sending remote invocation responses.

    - #### setAcceptProxyClasses

          public void setAcceptProxyClasses(boolean acceptProxyClasses)

      Set whether to accept deserialization of proxy classes.

      Default is "true". May be deactivated as a security measure.

    - #### isAcceptProxyClasses

          public boolean isAcceptProxyClasses()

      Return whether to accept deserialization of proxy classes.

    - #### afterPropertiesSet

          public void afterPropertiesSet()

      指定者:
        `afterPropertiesSet` 在接口中 `org.springframework.beans.factory.InitializingBean`

    - #### prepare

          public void prepare()

      Initialize this service exporter.

    - #### getProxy

          protected final Object getProxy()

    - #### createObjectInputStream

          protected ObjectInputStream createObjectInputStream(InputStream is)
                                                       throws IOException

      Create an ObjectInputStream for the given InputStream.

      The default implementation creates a Spring `CodebaseAwareObjectInputStream`.

      参数:
        `is` - the InputStream to read from
      返回:
        the new ObjectInputStream instance to use
      抛出:
        `IOException` - if creation of the ObjectInputStream failed

    - #### doReadRemoteInvocation

          protected RemoteInvocation doReadRemoteInvocation(ObjectInputStream ois)
                                                     throws IOException,
                                                            ClassNotFoundException

      Perform the actual reading of an invocation result object from the given ObjectInputStream.

      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 from
      返回:
        the RemoteInvocationResult object
      抛出:
        `IOException` - in case of I/O failure
        `ClassNotFoundException` - if case of a transferred class not being found in the local ClassLoader

    - #### createObjectOutputStream

          protected ObjectOutputStream createObjectOutputStream(OutputStream os)
                                                         throws IOException

      Create an ObjectOutputStream for the given OutputStream.

      The default implementation creates a plain `ObjectOutputStream`.

      参数:
        `os` - the OutputStream to write to
      返回:
        the new ObjectOutputStream instance to use
      抛出:
        `IOException` - if creation of the ObjectOutputStream failed

    - #### doWriteRemoteInvocationResult

          protected void doWriteRemoteInvocationResult(RemoteInvocationResult result,
                                                       ObjectOutputStream oos)
                                                throws IOException

      Perform the actual writing of the given invocation result object to the given ObjectOutputStream.

      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 object
        `oos` - the ObjectOutputStream to write to
      抛出:
        `IOException` - if thrown by I/O methods