站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

HessianClientInterceptor (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

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.HessianClientInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor, InitializingBean
Direct Known Subclasses:
HessianProxyFactoryBean

public class HessianClientInterceptor
extends UrlBasedRemoteAccessor
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: There is no requirement for services accessed with this proxy factory to have been exported using Spring's HessianServiceExporter, as there is no special handling involved. As a consequence, you can also access services that have been exported using Caucho's HessianServlet.

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

Field Summary
 
Fields inherited from class org.springframework.remoting.support.RemoteAccessor
logger
 
Constructor Summary
HessianClientInterceptor()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
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 setOverloadEnabled(boolean overloadEnabled)
          Set whether overloaded methods should be enabled for remote invocations.
 void setPassword(String password)
          Set the password that this factory should use to access the remote service.
 void setProxyFactory(com.caucho.hessian.client.HessianProxyFactory proxyFactory)
          Set the HessianProxyFactory instance to use.
 void setSendCollectionType(boolean sendCollectionType)
          Set whether to send the Java collection type for each serialized collection.
 void setSerializerFactory(com.caucho.hessian.io.SerializerFactory serializerFactory)
          Specify the Hessian SerializerFactory to use.
 void setUsername(String username)
          Set the username that this factory should use to access the remote service.
 
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.


setSerializerFactory

public void setSerializerFactory(com.caucho.hessian.io.SerializerFactory serializerFactory)
Specify the Hessian SerializerFactory to use.

This will typically be passed in as an inner bean definition of type com.caucho.hessian.io.SerializerFactory, with custom bean property values applied.


setSendCollectionType

public void setSendCollectionType(boolean sendCollectionType)
Set whether to send the Java collection type for each serialized collection. Default is "true".


setUsername

public void setUsername(String username)
Set the username that this factory should use to access the remote service. Default is none.

The username will be sent by Hessian via HTTP Basic Authentication.

See Also:
HessianProxyFactory.setUser(java.lang.String)

setPassword

public void setPassword(String password)
Set the password that this factory should use to access the remote service. Default is none.

The password will be sent by Hessian via HTTP Basic Authentication.

See Also:
HessianProxyFactory.setPassword(java.lang.String)

setOverloadEnabled

public void setOverloadEnabled(boolean overloadEnabled)
Set whether overloaded methods should be enabled for remote invocations. Default is "false".

See Also:
HessianProxyFactory.setOverloadEnabled(boolean)

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class UrlBasedRemoteAccessor

prepare

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

Throws:
RemoteLookupFailureException - if the service URL is invalid

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.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

The Spring Framework

Copyright © 2002-2007 The Spring Framework.