I have jspx that the current HttpServletRequest getServerName() should know. Jspx can get this using #{mybean.serverName} from its bean, for example:
public String getServerName() { HttpServletRequest request = (HttpServletRequest) FacesInstance.getCurrentInstance().getExternalContent().getRequest(); return request.getServerName(); }
However, when this is serviced by a proxy (Apache with mod_proxy), getServerName() will return the hostname node several times instead of the hostname of the interface. In other cases, it works correctly.
Simple jsp with <% request.getServerName(); %> <% request.getServerName(); %> will, however, always return the hostname of the interface.
What is the problem with FacesInstance HttpServletRequest ? Is there a way to get the "real" request object?
source share