[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:
import org.omnifaces.util.Faces;
...
// requestHostname may
be localhost,
89.38.156.5,
etc
String requestHostname =
Faces.getRequestHostname();
Niciun comentariu :
Trimiteți un comentariu