public class XRemotingProxyFactory extends Object
Factory for proxy instances through which remote calls may be made.
Here's an example:
XRemotingProxyFactory factory = new XRemotingProxyFactory("http://yourhost.com/your-service");
YourService yourService = (YourService) factory.create(YourService.class);
// now call any methods on yourService
There're basically two things you can parameterize: Requester and
Serializer. For a Serializer, XStream-based serialization is the
default. For Requester, the simplest implementation is HttpRequester
which allows to invoke service exposed via HTTP (it is the default option
for the simplest constructor XRemotingProxyFactory(String)).
If you need some of more sophisticated features of HTTP (like SSL or
authentication), you may consider CommonsHttpClientRequester which
gives access to the full power of HttpClient.
Serializer,
Requester,
XStreamSerializer,
HttpRequester,
CommonsHttpClientRequester| Modifier and Type | Field and Description |
|---|---|
protected Requester |
requester |
protected Serializer |
serializer |
| Constructor and Description |
|---|
XRemotingProxyFactory(Requester requester)
Creates a factory with XStream-based serialization.
|
XRemotingProxyFactory(Requester requester,
Class<? extends Serializer> serializerClass)
Creates a factory with the given
Serializer implementation class. |
XRemotingProxyFactory(Requester requester,
Serializer serializer)
Creates a factory with the given
Serializer. |
XRemotingProxyFactory(Requester requester,
String serializerClassName)
Creates a factory with serialization implemented by class given by name.
|
XRemotingProxyFactory(Requester requester,
String serializerClassName,
ClassLoader spiClassLoader)
Creates a factory with serialization implemented by class given by name,
and loaded from the given classloader.
|
XRemotingProxyFactory(String url)
Creates a factory with XStream-based serialization and simple HTTP-based
transport.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
create(Class<?> iface)
Creates a proxy for the given interface.
|
Object |
create(Class<?>[] ifaces)
Creates a proxy for the given interfaces.
|
Object |
create(Class<?>[] ifaces,
ClassLoader proxyLoader)
Creates a proxy for the given interfaces.
|
Object |
create(Class<?> iface,
ClassLoader proxyLoader)
Creates a proxy for the given interface.
|
protected HttpConnectionFactory |
createDefaultHttpConnectionFactory() |
protected Requester |
createDefaultRequester(String url) |
protected Serializer |
createDefaultSerializer() |
protected Serializer |
createSerializer(Class<? extends Serializer> serializerClass) |
protected ClassLoader |
getDefaultClassLoader() |
protected Serializer serializer
protected Requester requester
public XRemotingProxyFactory(String url)
url - service URLpublic XRemotingProxyFactory(Requester requester)
requester - requester to usepublic XRemotingProxyFactory(Requester requester, String serializerClassName)
requester - requester to useserializerClassName - name of the Serializer
implementation classpublic XRemotingProxyFactory(Requester requester, String serializerClassName, ClassLoader spiClassLoader)
requester - requester to useserializerClassName - name of the Serializer
implementation classspiClassLoader - classloader from which to load Serializer
implementationpublic XRemotingProxyFactory(Requester requester, Class<? extends Serializer> serializerClass)
Serializer implementation class.requester - requester to useserializerClass - class of a Serializer implementationpublic XRemotingProxyFactory(Requester requester, Serializer serializer)
Serializer.requester - requester to useserializer - serializer to usepublic Object create(Class<?> iface)
iface - interface for which to create proxypublic Object create(Class<?>[] ifaces)
ifaces - interfaces for which to create proxypublic Object create(Class<?> iface, ClassLoader proxyLoader)
iface - interface for which to create proxyproxyLoader - classloader for proxypublic Object create(Class<?>[] ifaces, ClassLoader proxyLoader)
ifaces - interfaces for which to create proxyproxyLoader - classloader for proxyprotected Serializer createSerializer(Class<? extends Serializer> serializerClass)
protected ClassLoader getDefaultClassLoader()
protected Serializer createDefaultSerializer()
protected HttpConnectionFactory createDefaultHttpConnectionFactory()
Copyright © 2015. All rights reserved.