How to get Remote / Client IP address using RESTful web service in java?
I have written Rest web service in my project.The web service call may come from different machine.so i need to find out the IP address through REST webservice. From this link request.getRemoteAddr() to use this. But i cant use getRemoteAddr(). Because my request and response are xml format. I have used post method in REST service.Tomcat server.I have send request as xml format. How can i get the IP address? Assuming you are using JAX-RS: @GET Produces("application/xlm") public String getData(@Context HttpServletRequest request){ String ip = request.getRemoteAddr(); } The @Context annotation