javaweb-servicesrestjax-rsrestful-authentication

Rest - how get IP address of caller


I am writing a Java Rest Web Service and need the caller's IP Address. I thought I saw this in the cookie once but now I don't see it. Is there a consistent place to get this information?

I saw one example of using an "OperationalContext" to get it but that was not in java.


Solution

  • I think you can get the IP through the request object.

    If I'm not mistaken, request.getRemoteAddr() or so.