I was reading that “With every Request to your web application, client’s IP is sent too. So all you need to do is to have Filter over Requests and you can store the IP. “
If this is so,how can I do this ? I mean what is the method that can tell me the IP sent in the request ?
Create a Filter class that implements
javax.servlet.Filter, and fetch the IP fromServletRequestusinggetRemoteAddr():If your client is behind a proxy, try using
request.getHeader("x-forwarded-for")instead, though this may or may not work depending on the configuration of the proxy.