When I implement an RMI server (implement an interface that extends java.rmi.Remote) is there a way to get information about the current RMI request context, specifically the remote client's IP address?
public void myMethod() throws RemoteException {
log.info("remote IP is "+ RMISomething.getSomething());
}
To make a remote object visible to clients through the RMI registry service, you need to explicitly create the object inside a Java VM on the server and then register that object using the bind() or rebind() method on the Registry.
The string name accepted by the RMI registry has the syntax "rmi://hostname:port/remoteObjectName", where hostname and port identify the machine and port, respectively, on which the RMI registry is running and remoteObjectName is the string name of the remote object.
RMI uses stub and skeleton object for communication with the remote object.
See java.rmi.server.RemoteServer#getClientHost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With