In usual case the method ServletRequest.getRemoteAddr() (or getRemoteHost() and getRemotePort()) should returns details of the actual client.
But, if its routed through a proxy, or  a differnt servlet engine you would be getting ip of those machines.  To tackle these situation you could try below operations
request.getHeader("VIA")             --> Gateway   
request.getHeader("X-FORWARDED-FOR")--> IPaddress
But this could return null if the request is directly from the client. You may handle the situation with some additional conditions to get valid data.