Standalone
Application
A security manager was not installed in the previous example because
applets use the security manager already installed in the client(s)
browser. The following example shows the steps needed to install
a security manager on the client side.
The source code needed for this example is stored in the examples\Standalone
directory. The "Standalone" directory
contains the following files:
- InfoInterface.java
- InfoServerImpl.java
- InfoClient.java
- Policy.txt
- Compile.bat
- Rmicompile.bat
- RunServer.bat
- RunClient.bat
The Remote Interface
Listing 6.5 InfoInterface.java
import java.rmi.*;
import java.rmi.server.*;
//Remote interface
public interface InfoInterface extends Remote {
//This method is used to get
//information about the client
public String getInfo()
throws RemoteException,ServerNotActiveException;
}
InfoInterface declares
a single method that returns the hostname of the current client.
|