Package com.caucho.burlap.client
Class BurlapProxyFactory
java.lang.Object
com.caucho.burlap.client.BurlapProxyFactory
- All Implemented Interfaces:
ServiceProxyFactory
,ObjectFactory
Factory for creating Burlap client stubs. The returned stub will
call the remote object for all methods.
String url = "http://localhost:8080/ejb/hello"; HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);After creation, the stub can be like a regular Java class. Because it makes remote calls, it can throw more exceptions than a Java class. In particular, it may throw protocol exceptions. The factory can also be configured as a JNDI resource. The factory expects to parameters: "type" and "url", corresponding to the two arguments to
create
In Resin 3.0, the above example would be configured as:
<reference> <name>hessian/hello</name> <factory>com.caucho.hessian.client.HessianProxyFactory</factory> <init url="http://localhost:8080/ejb/hello"/> type="test.HelloHome"/> </reference>To get the above resource, use JNDI as follows:
Context ic = new InitialContext(); HelloHome hello = (HelloHome) ic.lookup("java:comp/env/burlap/hello"); System.out.println("Hello: " + hello.helloWorld());
Authentication
The proxy can use HTTP basic authentication if the user and the password are set.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new proxy with the specified URL.Creates a new proxy with the specified URL.static char
encode
(long d) getObjectInstance
(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) JNDI object factory so the proxy can be used as a resource.Returns the remote resolver.boolean
Returns true if overloaded methods are allowed (using mangling)protected URLConnection
openConnection
(URL url) Creates the URL connection.void
setOverloadEnabled
(boolean isOverloadEnabled) set true if overloaded methods are allowed (using mangling)void
setPassword
(String password) Sets the password.void
Sets the user.
-
Constructor Details
-
BurlapProxyFactory
public BurlapProxyFactory()Creates the new proxy factory.
-
-
Method Details
-
setUser
Sets the user. -
setPassword
Sets the password. -
isOverloadEnabled
public boolean isOverloadEnabled()Returns true if overloaded methods are allowed (using mangling) -
setOverloadEnabled
public void setOverloadEnabled(boolean isOverloadEnabled) set true if overloaded methods are allowed (using mangling) -
getRemoteResolver
Returns the remote resolver. -
openConnection
Creates the URL connection.- Throws:
IOException
-
create
Creates a new proxy with the specified URL. The API class uses the java.api.class value from _hessian_- Parameters:
url
- the URL where the client object is located.- Returns:
- a proxy to the object with the specified interface.
- Throws:
MalformedURLException
ClassNotFoundException
-
create
Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by api.String url = "http://localhost:8080/ejb/hello"); HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);
- Specified by:
create
in interfaceServiceProxyFactory
- Parameters:
api
- the interface the proxy class needs to implementurl
- the URL where the client object is located.- Returns:
- a proxy to the object with the specified interface.
- Throws:
MalformedURLException
-
getBurlapInput
-
getBurlapOutput
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws ExceptionJNDI object factory so the proxy can be used as a resource.- Specified by:
getObjectInstance
in interfaceObjectFactory
- Throws:
Exception
-
encode
public static char encode(long d)
-