views:

1947

answers:

2

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());

}
A: 

I don't believe that this information can be obtained unless it is passed in the remote method call. I checked both the RMISecurityManager and the UnicastRemoteObject classes to see if it could be obtained from them, and I didn't see anything.

mattsidesinger
+1  A: 

See java.rmi.server.RemoteServer#getClientHost

Kevin