-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Can I get the name of the machine from where my application is getting accessed in the zkoss framework?
Please share if anybody has used this feature.
Thanks,Dino
Basically what I want is to know the name or IP address of the machine from where the user is accessing my application so that I can provide the customization option to the user to make its own homepage by setting the selected home page as cookie alongwith the IP address.
Do you have any idea how can I provide the user with this customization option by any ohter way?
Hi,
you can try to use Executions.getCurrent().getRemoteAddr() and Executions.getCurrent().getRemoteHost() (both methods are delegates from ServletRequest):
More info here:
http://docstore.mik.ua/orelly/java-ent/servlet/ch04_03.htm
Cheers, Maik
Do you run your application-server behind a HTTP-Server like Apache or a Proxy? If so, you have to look if the HTTP-Server/Proxy adds a X-Forwarded-For-Header to the request:
http://en.wikipedia.org/wiki/X-Forwarded-For
Cheers, Maik
Maybe u can use the log of Tomcat to get the access ip...
http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html#Access_Log_Valve
%a - Remote IP address
If you work with spring-security you can get it from the Authentication Object.
Asked: 2010-08-05 01:50:53 +0800
Seen: 794 times
Last updated: Aug 10 '10