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);
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?
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?
Joined: Mar 09, 2006
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com