org.springframework.remoting.caucho
Class HessianClientInterceptor

java.lang.Object
  extended by org.springframework.remoting.support.RemoteAccessor
      extended by org.springframework.remoting.support.UrlBasedRemoteAccessor
          extended by org.springframework.remoting.caucho.CauchoRemoteAccessor
              extended by org.springframework.remoting.caucho.HessianClientInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor, InitializingBean
Direct Known Subclasses:
HessianProxyFactoryBean

public class HessianClientInterceptor
extends CauchoRemoteAccessor
implements MethodInterceptor

Interceptor for accessing a Hessian service. Supports authentication via username and password. The service URL must be an HTTP URL exposing a Hessian service.

Hessian is a slim, binary RPC protocol. For information on Hessian, see the Hessian website

Note: Hessian services accessed with this proxy factory do not have to be exported via HessianServiceExporter, as there isn't any special handling involved. Therefore, you can also access services that are exported via Caucho's HessianServlet.

Since:
29.09.2003
Author:
Juergen Hoeller
See Also:
RemoteAccessor.setServiceInterface(java.lang.Class), UrlBasedRemoteAccessor.setServiceUrl(java.lang.String), CauchoRemoteAccessor.setUsername(java.lang.String), CauchoRemoteAccessor.setPassword(java.lang.String), HessianServiceExporter, HessianProxyFactoryBean, HessianProxyFactory

Field Summary
 
Fields inherited from class org.springframework.remoting.support.RemoteAccessor
logger
 
Constructor Summary
HessianClientInterceptor()
           
 
Method Summary
protected  RemoteAccessException convertHessianAccessException(Throwable ex)
          Convert the given Hessian access exception to an appropriate Spring RemoteAccessException.
protected  Object createHessianProxy(com.caucho.hessian.client.HessianProxyFactory proxyFactory)
          Create the Hessian proxy that is wrapped by this interceptor.
 Object invoke(MethodInvocation invocation)
           
 void prepare()
          Initialize the Hessian proxy for this interceptor.
 void setProxyFactory(com.caucho.hessian.client.HessianProxyFactory proxyFactory)
          Set the HessianProxyFactory instance to use.
 
Methods inherited from class org.springframework.remoting.caucho.CauchoRemoteAccessor
afterPropertiesSet, getPassword, getUsername, isOverloadEnabled, setOverloadEnabled, setPassword, setUsername
 
Methods inherited from class org.springframework.remoting.support.UrlBasedRemoteAccessor
getServiceUrl, setServiceUrl
 
Methods inherited from class org.springframework.remoting.support.RemoteAccessor
getServiceInterface, setServiceInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HessianClientInterceptor

public HessianClientInterceptor()
Method Detail

setProxyFactory

public void setProxyFactory(com.caucho.hessian.client.HessianProxyFactory proxyFactory)
Set the HessianProxyFactory instance to use. If not specified, a default HessianProxyFactory will be created.

Allows to use an externally configured factory instance, in particular a custom HessianProxyFactory subclass.


prepare

public void prepare()
             throws MalformedURLException
Initialize the Hessian proxy for this interceptor.

Overrides:
prepare in class CauchoRemoteAccessor
Throws:
MalformedURLException - if thrown by Hessian/Burlap API
See Also:
prepare(), BurlapClientInterceptor.prepare()

createHessianProxy

protected Object createHessianProxy(com.caucho.hessian.client.HessianProxyFactory proxyFactory)
                             throws MalformedURLException
Create the Hessian proxy that is wrapped by this interceptor.

Parameters:
proxyFactory - the proxy factory to use
Returns:
the Hessian proxy
Throws:
MalformedURLException - if thrown by the proxy factory
See Also:
HessianProxyFactory.create(java.lang.Class, java.lang.String)

invoke

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

convertHessianAccessException

protected RemoteAccessException convertHessianAccessException(Throwable ex)
Convert the given Hessian access exception to an appropriate Spring RemoteAccessException.

Parameters:
ex - the exception to convert
Returns:
the RemoteAccessException to throw


Copyright (c) 2002-2007 The Spring Framework Project.