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?
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.