Forums Register Login

RMI and callback client codebase

+Pie Number of slices to send: Send
We have an applet which acts as a callback client for an RMI server.
The applet registers itself with the RMI server for callback .
The RMI Server and the registry is running on the host on which the applet is downloaded.
The code for registering the applet as a callback client is as follows:
Registry registry =
LocateRegistry.getRegistry(getCodeBase().getHost(), RMIInterface.REGISTRY_PORT);
RMIInterface remoteReference =
(RMIInterface) registry.lookup(RMIInterface.REGISTRY_NAME);

try {

System.out.println("Registering for notification");
UnicastRemoteObject.exportObject(this);
remoteReference.registerForNotification(this);
}

In the java console ,we notice that the rmiregistry connects to the document root of the Applet URL for getting the client stub on UnicastRemoteObject.exportObject(this).
Is this because we have specified the applet as:
<APPLET CODE = "com.ibm.applet.PackagedApplet.class" archive="applet/remotermi.jar"
WIDTH = 500 HEIGHT = 50
id="Fractal">
How can we specify the rmiregistry to look for the client stub at an alternate location,rather than going to the webserver hosting the applet ,to retrieve it?
In this case ,we need the rmiregistry to pick up the client stub from the local machine(rmi server codebase is an option) on which the applet is downloaded.
How can that be done?
+Pie Number of slices to send: Send
 

How can we specify the rmiregistry to look for the client stub at an alternate location,rather than going to the webserver hosting the applet ,to retrieve it?


getCodeBase() is naturally going to refer to the source URL.

How about a parameter in the Applet tags to give a local address, or maybe the user can enter an address in the applet?

The real question in my mind is - why an applet? In order to connect to a local resource won't it have to be signed, etc.? Perhaps this is more a Java Webstart type of application?

Bill
+Pie Number of slices to send: Send
The server is indeed a webstart application,initialiased by another applet.
For it to call back on a client applet,we need the client stub to be packaged with the server;rather than the registry going to the client URL for the stub.
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1138 times.
Similar Threads
I am close to submit - question about rmi
RMI callback
Naming.Lookup and Rebind
how RMI works?
Restrictions on RMI - what does that mean to me?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:25:07.