T
Tim Slattery
I've just read a proposal for a new J2EE web system - or maybe a
cut-down version of an existing one. Regardless, there are some new
requirements. One of those is to record the IP address of the user.
I'm using Struts, so my Action objects get passed an
HttpServletRequest object and an HttpServletResponse object. I can't
figure out how to get the IP address of the user from those things. I
can get HTTP headers, but it's not there. I can get an HttpSession
object, but it doesn't seem to be there. There's a ServletContext
object that can be obtained from the HttpSession, but that doesn't
seem to do it either.
To complicate matters, this J2EE system runs behind an IIS gateway. Is
there a simple way to do this, or does the gateway have to be modified
to pass the IP address as another bit of data?
cut-down version of an existing one. Regardless, there are some new
requirements. One of those is to record the IP address of the user.
I'm using Struts, so my Action objects get passed an
HttpServletRequest object and an HttpServletResponse object. I can't
figure out how to get the IP address of the user from those things. I
can get HTTP headers, but it's not there. I can get an HttpSession
object, but it doesn't seem to be there. There's a ServletContext
object that can be obtained from the HttpSession, but that doesn't
seem to do it either.
To complicate matters, this J2EE system runs behind an IIS gateway. Is
there a simple way to do this, or does the gateway have to be modified
to pass the IP address as another bit of data?