How to get client IP address inside struts2 action method?

Is there any way to get client IP address inside struts2 action method?

I have implemented interfaces SesionAwareand RequestAware, but these two insert only session and request cards.

+3
source share
3 answers

Have you tried ServletRequestAware ?

+4
source

Try request.getRemoteAddress (). This will give you the client IP address. If the request goes through a proxy server, then you will only get the proxy server ip.

+2
source

ServletRequest.getRemoteAddress() API, IP- . API Servlet, Struts2.

0

Source: https://habr.com/ru/post/1770595/


All Articles