Class HttpInvokerClientInterceptor

              extended byorg.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor
All Implemented Interfaces:
Advice, HttpInvokerClientConfiguration, Interceptor, MethodInterceptor
Direct Known Subclasses:

public class HttpInvokerClientInterceptor
extends RemoteInvocationBasedAccessor
implements MethodInterceptor, HttpInvokerClientConfiguration

Interceptor for accessing an HTTP invoker service. The service URL must be an HTTP URL exposing an HTTP invoker service.

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 and Burlap protocols.

HTTP invoker is a very extensible and customizable protocol. It supports the RemoteInvocationFactory mechanism, like RMI invoker, allowing to include additional invocation attributes (for example, a security context). Furthermore, it allows to customize request execution via the HttpInvokerRequestExecutor strategy.

Can use the JDK's RMIClassLoader to load classes from a given codebase, performing on-demand dynamic code download from a remote location. The codebase can consist of multiple URLs, separated by spaces. Note that RMIClassLoader requires a SecurityManager to be set, like when using dynamic class download with standard RMI! (See the RMI documentation for details.)

Juergen Hoeller
See Also:
UrlBasedRemoteAccessor.setServiceUrl(java.lang.String), setCodebaseUrl(java.lang.String), RemoteInvocationBasedAccessor.setRemoteInvocationFactory(, setHttpInvokerRequestExecutor(org.springframework.remoting.httpinvoker.HttpInvokerRequestExecutor), HttpInvokerServiceExporter, HttpInvokerProxyFactoryBean, RMIClassLoader

Field Summary
Fields inherited from class
Constructor Summary
Method Summary
protected  RemoteInvocationResult executeRequest(RemoteInvocation invocation)
          Execute the given remote invocation via the HttpInvokerRequestExecutor.
 String getCodebaseUrl()
          Return the codebase URL to download classes from if not found locally.
 HttpInvokerRequestExecutor getHttpInvokerRequestExecutor()
          Return the HttpInvokerRequestExecutor used by this remote accessor.
 Object invoke(MethodInvocation methodInvocation)
 void setCodebaseUrl(String codebaseUrl)
          Set the codebase URL to download classes from if not found locally.
 void setHttpInvokerRequestExecutor(HttpInvokerRequestExecutor httpInvokerRequestExecutor)
          Set the HttpInvokerRequestExecutor implementation to use for executing remote invocations.
Methods inherited from class
createRemoteInvocation, getRemoteInvocationFactory, recreateRemoteInvocationResult, setRemoteInvocationFactory
Methods inherited from class
getServiceUrl, setServiceUrl
Methods inherited from class
getServiceInterface, setServiceInterface
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration

Constructor Detail


public HttpInvokerClientInterceptor()
Method Detail


public void setCodebaseUrl(String codebaseUrl)
Set the codebase URL to download classes from if not found locally. Can consists of multiple URLs, separated by spaces.

Follows RMI's codebase conventions for dynamic class download. In contrast to RMI, where the server determines the URL for class download (via the "java.rmi.server.codebase" system property), it's the client that determines the codebase URL here. The server will usually be the same as for the service URL, just pointing to a different path there.

See Also:
UrlBasedRemoteAccessor.setServiceUrl(java.lang.String), CodebaseAwareObjectInputStream, RMIClassLoader


public String getCodebaseUrl()
Return the codebase URL to download classes from if not found locally.

Specified by:
getCodebaseUrl in interface HttpInvokerClientConfiguration
the codebase URL, or null if none
See Also:


public void setHttpInvokerRequestExecutor(HttpInvokerRequestExecutor httpInvokerRequestExecutor)
Set the HttpInvokerRequestExecutor implementation to use for executing remote invocations.

Default is SimpleHttpInvokerRequestExecutor. Alternatively, consider CommonsHttpInvokerRequestExecutor for more sophisticated needs.

See Also:
SimpleHttpInvokerRequestExecutor, CommonsHttpInvokerRequestExecutor


public HttpInvokerRequestExecutor getHttpInvokerRequestExecutor()
Return the HttpInvokerRequestExecutor used by this remote accessor.


public Object invoke(MethodInvocation methodInvocation)
              throws Throwable
Specified by:
invoke in interface MethodInterceptor


protected RemoteInvocationResult executeRequest(RemoteInvocation invocation)
                                         throws IOException,
Execute the given remote invocation via the HttpInvokerRequestExecutor.

Can be overridden in subclasses to pass a different configuration object to the executor. Alternatively, add further configuration properties in a subclass of this accessor: By default, the accessor passed itself as configuration object to the executor.

invocation - the RemoteInvocation to execute
the RemoteInvocationResult object
IOException - if thrown by I/O operations
ClassNotFoundException - if thrown during deserialization
See Also:
getHttpInvokerRequestExecutor(), HttpInvokerClientConfiguration

Copyright (C) 2003-2004 The Spring Framework Project.