|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.remoting.support.RemotingSupport
org.springframework.remoting.support.RemoteAccessor
org.springframework.remoting.support.UrlBasedRemoteAccessor
org.springframework.remoting.support.RemoteInvocationBasedAccessor
org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor
public class HttpInvokerClientInterceptor
org.aopalliance.intercept.MethodInterceptor
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, analogous to
when using dynamic class download with standard RMI!
(See the RMI documentation for details.)
UrlBasedRemoteAccessor.setServiceUrl(java.lang.String)
,
setCodebaseUrl(java.lang.String)
,
RemoteInvocationBasedAccessor.setRemoteInvocationFactory(org.springframework.remoting.support.RemoteInvocationFactory)
,
setHttpInvokerRequestExecutor(org.springframework.remoting.httpinvoker.HttpInvokerRequestExecutor)
,
HttpInvokerServiceExporter
,
HttpInvokerProxyFactoryBean
,
RMIClassLoader
Field Summary | |
---|---|
private java.lang.String |
codebaseUrl
|
private HttpInvokerRequestExecutor |
httpInvokerRequestExecutor
|
Fields inherited from class org.springframework.remoting.support.RemotingSupport |
---|
logger |
Constructor Summary | |
---|---|
HttpInvokerClientInterceptor()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected RemoteAccessException |
convertHttpInvokerAccessException(java.lang.Throwable ex)
Convert the given HTTP invoker access exception to an appropriate Spring RemoteAccessException. |
protected RemoteInvocationResult |
executeRequest(RemoteInvocation invocation)
Execute the given remote invocation via the HttpInvokerRequestExecutor. |
protected RemoteInvocationResult |
executeRequest(RemoteInvocation invocation,
MethodInvocation originalInvocation)
Execute the given remote invocation via the HttpInvokerRequestExecutor. |
java.lang.String |
getCodebaseUrl()
Return the codebase URL to download classes from if not found locally. |
HttpInvokerRequestExecutor |
getHttpInvokerRequestExecutor()
Return the HttpInvokerRequestExecutor used by this remote accessor. |
java.lang.Object |
invoke(MethodInvocation methodInvocation)
|
void |
setCodebaseUrl(java.lang.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 org.springframework.remoting.support.RemoteInvocationBasedAccessor |
---|
createRemoteInvocation, getRemoteInvocationFactory, recreateRemoteInvocationResult, setRemoteInvocationFactory |
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 org.springframework.remoting.support.RemotingSupport |
---|
getBeanClassLoader, overrideThreadContextClassLoader, resetThreadContextClassLoader, setBeanClassLoader |
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 |
---|
getServiceUrl |
Field Detail |
---|
private java.lang.String codebaseUrl
private HttpInvokerRequestExecutor httpInvokerRequestExecutor
Constructor Detail |
---|
public HttpInvokerClientInterceptor()
Method Detail |
---|
public void setCodebaseUrl(java.lang.String codebaseUrl)
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.
UrlBasedRemoteAccessor.setServiceUrl(java.lang.String)
,
CodebaseAwareObjectInputStream
,
RMIClassLoader
public java.lang.String getCodebaseUrl()
getCodebaseUrl
in interface HttpInvokerClientConfiguration
null
if noneRMIClassLoader
public void setHttpInvokerRequestExecutor(HttpInvokerRequestExecutor httpInvokerRequestExecutor)
Default is SimpleHttpInvokerRequestExecutor
. Alternatively,
consider using CommonsHttpInvokerRequestExecutor
for more
sophisticated needs.
SimpleHttpInvokerRequestExecutor
,
CommonsHttpInvokerRequestExecutor
public HttpInvokerRequestExecutor getHttpInvokerRequestExecutor()
Creates a default SimpleHttpInvokerRequestExecutor if no executor has been initialized already.
public void afterPropertiesSet()
InitializingBean
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.
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class UrlBasedRemoteAccessor
public java.lang.Object invoke(MethodInvocation methodInvocation) throws java.lang.Throwable
java.lang.Throwable
protected RemoteInvocationResult executeRequest(RemoteInvocation invocation, MethodInvocation originalInvocation) throws java.lang.Exception
This implementation delegates to executeRequest(RemoteInvocation)
.
Can be overridden to react to the specific original MethodInvocation.
invocation
- the RemoteInvocation to executeoriginalInvocation
- the original MethodInvocation (can e.g. be cast
to the ProxyMethodInvocation interface for accessing user attributes)
java.lang.Exception
- in case of errorsprotected RemoteInvocationResult executeRequest(RemoteInvocation invocation) throws java.lang.Exception
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
java.io.IOException
- if thrown by I/O operations
java.lang.ClassNotFoundException
- if thrown during deserialization
java.lang.Exception
- in case of general errorsgetHttpInvokerRequestExecutor()
,
HttpInvokerClientConfiguration
protected RemoteAccessException convertHttpInvokerAccessException(java.lang.Throwable ex)
ex
- the exception to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |