code: private String prependContextPath(ExternalContext externalContext, String url)
     {
        String contextPath = externalContext.getRequestContextPath();
        if ("/".equals(contextPath) || (url.startsWith(contextPath))) {
           return url;
        }
        return contextPath + url;
     }
docs: Adds the context path to the given context-relative URL.