spring-framework / org.springframework.remoting.httpinvoker

Package org.springframework.remoting.httpinvoker

Types

HttpComponentsHttpInvokerRequestExecutor

open class HttpComponentsHttpInvokerRequestExecutor : AbstractHttpInvokerRequestExecutor

org.springframework.remoting.httpinvoker.HttpInvokerRequestExecutor implementation that uses Apache HttpComponents HttpClient to execute POST requests.

Allows to use a pre-configured org.apache.http.client.HttpClient instance, potentially with authentication, HTTP connection pooling, etc. Also designed for easy subclassing, providing specific template methods.

As of Spring 4.1, this request executor requires Apache HttpComponents 4.3 or higher.

HttpInvokerProxyFactoryBean

open class HttpInvokerProxyFactoryBean : HttpInvokerClientInterceptor, FactoryBean<Any>

FactoryBean for HTTP invoker proxies. Exposes the proxied service for use as a bean reference, using the specified service interface.

The service URL must be an HTTP URL exposing an HTTP invoker service. Optionally, a codebase URL can be specified for on-demand dynamic code download from a remote location. For details, see HttpInvokerClientInterceptor docs.

Serializes remote invocation objects and deserializes remote invocation result objects. Uses Java serialization just like RMI, but provides the same ease of setup as Caucho's HTTP-based Hessian protocol.

HTTP invoker is the recommended protocol for Java-to-Java remoting. It is more powerful and more extensible than Hessian, at the expense of being tied to Java. Nevertheless, it is as easy to set up as Hessian, which is its main advantage compared to RMI.

WARNING: Be aware of vulnerabilities due to unsafe Java deserialization: Manipulated input streams could lead to unwanted code execution on the server during the deserialization step. As a consequence, do not expose HTTP invoker endpoints to untrusted clients but rather just between your own services. In general, we strongly recommend any other message format (e.g. JSON) instead.

HttpInvokerRequestExecutor

interface HttpInvokerRequestExecutor

Strategy interface for actual execution of an HTTP invoker request. Used by HttpInvokerClientInterceptor and its subclass HttpInvokerProxyFactoryBean.

Two implementations are provided out of the box:

  • SimpleHttpInvokerRequestExecutor: Uses JDK facilities to execute POST requests, without support for HTTP authentication or advanced configuration options.
  • HttpComponentsHttpInvokerRequestExecutor: Uses Apache's Commons HttpClient to execute POST requests, allowing to use a preconfigured HttpClient instance (potentially with authentication, HTTP connection pooling, etc).

SimpleHttpInvokerRequestExecutor

open class SimpleHttpInvokerRequestExecutor : AbstractHttpInvokerRequestExecutor

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 HttpComponentsHttpInvokerRequestExecutor for more sophisticated needs: The J2SE HttpURLConnection is rather limited in its capabilities.

SimpleHttpInvokerServiceExporter

open class SimpleHttpInvokerServiceExporter : RemoteInvocationSerializingExporter, HttpHandler

HTTP request handler that exports the specified service bean as HTTP invoker service endpoint, accessible via an HTTP invoker proxy. Designed for Sun's JRE 1.6 HTTP server, implementing the com.sun.net.httpserver.HttpHandler interface.

Deserializes remote invocation objects and serializes remote invocation result objects. Uses Java serialization just like RMI, but provides the same ease of setup as Caucho's HTTP-based Hessian protocol.

HTTP invoker is the recommended protocol for Java-to-Java remoting. It is more powerful and more extensible than Hessian, at the expense of being tied to Java. Nevertheless, it is as easy to set up as Hessian, which is its main advantage compared to RMI.

WARNING: Be aware of vulnerabilities due to unsafe Java deserialization: Manipulated input streams could lead to unwanted code execution on the server during the deserialization step. As a consequence, do not expose HTTP invoker endpoints to untrusted clients but rather just between your own services. In general, we strongly recommend any other message format (e.g. JSON) instead.