8 Jan, 2007
Accessing Client IP and Transport Session Related Data from MessageContext
If you are using Axis2 Web Archive (WAR) distribution, then you can easily get these information from the messagecontext.
Accessing Remote IP address from the message context: You can get the remote IP address of the client corresponding to the current message as follows;
String remoteAddress = (String)msgCtx.getProperty("REMOTE_ADDR"):Accessing ServletContext from the message context: You can obtain the ServletContext from message context as follows;
ServletContext servletContext = (ServletContext)msgCtx.getProperty("transport.http.servletContext"):Accessing HttpServletRequest from the message context: You can obtain the HttpServletRequest from message context as follows;
HttpServletRequest httpServletRequest = (HttpServletRequest)msgCtx.getProperty("transport.http.servletRequest"):Applies To:
Apache Axis2/Java, any version