private String getResourcePath(HttpServletRequest request) { String path = null; // if hstRequest is retrieved, then this servlet has been dispatched by hst component. HstRequest hstRequest = HstRequestUtils.getHstRequest(request); if (hstRequest != null) { path = hstRequest.getResourceID(); } if (path == null) { path = HstRequestUtils.getRequestPath(request); } if (path != null && !path.startsWith("/") && path.indexOf(':') > 0) { path = path.substring(path.indexOf(':') + 1); } return path; }
public static String getResourceRelPath(HttpServletRequest request) { String path = null; // if hstRequest is retrieved, then this servlet has been dispatched by hst component. HstRequest hstRequest = HstRequestUtils.getHstRequest(request); if (hstRequest != null) { path = hstRequest.getResourceID(); } if (path == null) { try { path = HstRequestUtils.getRequestPath(request); path = path.substring(request.getServletPath().length()); } catch (IllegalArgumentException e) { log.warn("Cannot decode uri: {}. {}", request.getRequestURI(), e.getMessage()); } } if (path != null && !path.startsWith("/") && path.indexOf(':') > 0) { path = path.substring(path.indexOf(':') + 1); } return path; }
path = HstRequestUtils.getRequestPath(request); path = path.substring(request.getServletPath().length()); try {
public HstContainerURL parseURL(HttpServletRequest request, HttpServletResponse response, ResolvedMount resolvedMount) { HstContainerURLImpl url = new HstContainerURLImpl(); url.setContextPath(request.getContextPath()); url.setHostName(HstRequestUtils.getFarthestRequestHost(request)); url.setPortNumber(HstRequestUtils.getRequestServerPort(request)); url.setRequestPath(HstRequestUtils.getRequestPath(request)); url.setCharacterEncoding(HstRequestUtils.getCharacterEncoding(request)); String uriEncoding = HstRequestUtils.getURIEncoding(request); url.setURIEncoding(uriEncoding); try { Map<String, String[]> paramMap = HstRequestUtils.parseQueryString(request); url.setParameters(paramMap); } catch (UnsupportedEncodingException e) { if (log.isDebugEnabled()) { log.warn("Unsupported encoding in request, using empty query parameters:", e); } else { log.warn("Unsupported encoding in request, using empty query parameters: " + e.toString()); } } url.setResolvedMountPath(resolvedMount.getResolvedMountPath()); url.setPathInfo(request.getPathInfo()); parseRequestInfo(url); return url; }
if(vHosts == null || vHosts.isExcluded(HstRequestUtils.getRequestPath(req))) { chain.doFilter(request, response); return; if (mount == null) { try { mount = vHosts.matchSiteMount(HstRequestUtils.getFarthestRequestHost(req), req.getContextPath() , HstRequestUtils.getRequestPath(req)); if(mount != null) { requestContext.setResolvedSiteMount(mount);
public HstContainerURL parseURL(HttpServletRequest request, HttpServletResponse response, ResolvedSiteMount resolvedSiteMount) { HstContainerURLImpl url = new HstContainerURLImpl(); url.setContextPath(request.getContextPath()); url.setHostName(HstRequestUtils.getFarthestRequestHost(request)); url.setPortNumber(HstRequestUtils.getRequestServerPort(request)); url.setRequestPath(HstRequestUtils.getRequestPath(request)); String characterEncoding = request.getCharacterEncoding(); if (characterEncoding == null) { characterEncoding = "ISO-8859-1"; } url.setCharacterEncoding(characterEncoding); Map<String, String []> paramMap = HttpUtils.parseQueryString(request); url.setParameters(paramMap); url.setResolvedMountPath(resolvedSiteMount.getResolvedMountPath()); String [] namespacedPartAndPathInfo = splitPathInfo(resolvedSiteMount, request, characterEncoding); url.setPathInfo(namespacedPartAndPathInfo[1]); parseRequestInfo(url,namespacedPartAndPathInfo[0]); return url; }