miercuri, 25 martie 2015

[OmniFaces utilities (2.0)] Get the HTTP request hostname


[OmniFaces utilities] The getRequestHostname() method returns the HTTP request hostname. This is the entire domain, without any scheme and slashes. Noted should be that this value is extracted from the request URL, not from HttpServletRequest#getServerName() as its outcome can be influenced by proxies.

Method:
Usage:

import org.omnifaces.util.Faces;
...
// requestHostname may be localhost, 89.38.156.5, etc
String requestHostname = Faces.getRequestHostname();

Niciun comentariu:

Trimiteți un comentariu