The ServletRequest class has functions for finding out the IP address or host name of the client machine. getRemoteAddr() gets the IP address of the client machine and getRemoteHost() gets the host name of the client machine.
Getting a client’s address and hostname requires that you:
Get clients ip adfress using HttpServletRequest.getRemoteAddr().
Get clients hostname using HttpServletRequest.getRemoteHost().