on 08-14-2006 9:16 AM
Hello,
Is it possible, using the Web Dynpro API, to get the IP of the client who called the application?
Roy,
Use this code:
String ipAddress = WDProtocolAdapter
.getProtocolAdapter()
.getRequestObject()
.getClientHostAddress();
But please note that, this doesn't take care of proxy server issues.
Regards,
Satyajit.
Message was edited by: Satyajit Chakraborty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need the IP since we have few branches who are using the portal and I need to costumise a certain behaviour according to the branch. At the moment, each branch has it's own proxy which generates an IP. I need this IP.
Could you please elaborate regarding non-api methods approach even though it is highly discouraged?
Roy,
May the WD gods have mercy on me for giving this solution
String ipAddress = WDWebContextAdapter
.getWebContextAdapter()
.getHttpServletRequest()
.getRemoteHost();
For using this approach, or to even see the getHttpServletRequest() method you should have the servlet.jar file in the classpath.
But beware that in the next version this method will be made non-public and your application will no longer run.
I would suggest using Java servlets for this purpose.
Regards,
Satyajit.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.