Foros de discusión

request.getRemoteAddr() in JSP/PortletRequest

Anupam D D, modificado hace 15 años.

request.getRemoteAddr() in JSP/PortletRequest

New Member Mensajes: 7 Fecha de incorporación: 23/06/08 Mensajes recientes
Does anyone know how I can get the value of the user's IP address. Normally you'd get it using HttpServletRequest.getRemoteAddr()

I tried something like this, which returns null:
javax.servlet.http.HttpServletRequest req1 = (javax.servlet.http.HttpServletRequest) request;
req1.getRemoteUser();

Even better would be to get to remoteAddr in an action where the request object is of type PortletRequest
I tried using PortletRequest.getRemoteUser() but no joy here.

There's another post somewhere as to being able to get it when using Faces but that doesn't help me.


Thanks in advance
thumbnail
Björn Ryding, modificado hace 15 años.

RE: request.getRemoteAddr() in JSP/PortletRequest

Liferay Master Mensajes: 582 Fecha de incorporación: 16/05/07 Mensajes recientes
Try:
PortalUtil.getOriginalServletRequest(request).getRemoteAddr()

- Björn