JSF Return Hostname and App name

Reading Time: < 1 minute
private static HttpServletRequest request = (HttpServletRequest) FacesContext
            .getCurrentInstance().getExternalContext().getRequest();
    static Logger logger = LoggerFactory.getLogger(JSFUtils.class);

    public static String getServerHost() {
        return "http://" + request.getServerName() + ":" + request.getServerPort();
    }

    public static String getServerHostWithAppName(){
        String url = null;
        try {
            url =  new URL(request.getScheme(),
                    request.getServerName(),
                    request.getServerPort(),
                    request.getContextPath()).toString();
        } catch (MalformedURLException e) {
           logger.error(e.toString());
        }
        return url;
    }