/***************************************************************************** * Computes the "Context Base URL" of this servlet, which will include the * extra stub of the path that refers to the mapping for the specific servlet. */ public static String getContextBaseURL2(HttpServletRequest hsr) { String baseurl = getBaseURL2(hsr); String servletpath = hsr.getServletPath(); if (servletpath == null || servletpath == "") { return baseurl; } int embedpoint = baseurl.lastIndexOf(servletpath); if (embedpoint == -1) { throw new UniversalRuntimeException("Cannot locate servlet path of " + servletpath + " within base url of of " + baseurl); } String togo = baseurl.substring(0, embedpoint); if (togo.charAt(togo.length() - 1) != '/') { togo += '/'; } return togo; } //
public void init() { sbup = new StaticBaseURLProvider(); String baseurl = ServletUtil.getBaseURL2(request); String resourcebaseurl = ServletUtil.getContextBaseURL2(request); sbup.setBaseURL(baseurl); sbup.setResourceBaseURL(resourcebaseurl); }
String baseURL2 = ServletUtil.getBaseURL2(req); Logger.log.info("baseURL2: " + baseURL2); String requestURI = req.getRequestURL().toString();
public StaticBaseURLProvider computeBaseURLProvider(HttpServletRequest request) { ServletContext servletcontext = wac.getServletContext(); // yes, these two fields are not request-scope, but not worth creating // a whole new class and bean file for them. resourceurlbase = servletcontext.getInitParameter("resourceurlbase"); if (resourceurlbase == null) { resourceurlbase = ServletUtil.computeContextName(servletcontext); } // compute the baseURLprovider. StaticBaseURLProvider sbup = new StaticBaseURLProvider(); String baseurl = fixSakaiURL(request, ServletUtil.getBaseURL2(request)); sbup.setResourceBaseURL(computeResourceURLBase(baseurl)); // baseurl += SakaiEarlyRequestParser.FACES_PATH + "/"; sbup.setBaseURL(baseurl); return sbup; }
public StaticBaseURLProvider computeBaseURLProvider(HttpServletRequest request) { ServletContext servletcontext = wac.getServletContext(); // yes, these two fields are not request-scope, but not worth creating // a whole new class and bean file for them. resourceurlbase = servletcontext.getInitParameter("resourceurlbase"); if (resourceurlbase == null) { resourceurlbase = ServletUtil.computeContextName(servletcontext); } // compute the baseURLprovider. StaticBaseURLProvider sbup = new StaticBaseURLProvider(); String baseurl = fixSakaiURL(request, ServletUtil.getBaseURL2(request)); sbup.setResourceBaseURL(computeResourceURLBase(baseurl)); // baseurl += SakaiEarlyRequestParser.FACES_PATH + "/"; sbup.setBaseURL(baseurl); return sbup; }