private int getLookupPathIndex(HttpServletRequest request) { UrlPathHelper pathHelper = getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(request); String lookupPath = pathHelper.getLookupPathForRequest(request); return requestUri.indexOf(lookupPath); }
private void initLookupPath(ResourceUrlProvider urlProvider) { this.resourceUrlProvider = urlProvider; if (this.indexLookupPath == null) { UrlPathHelper pathHelper = this.resourceUrlProvider.getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(this); String lookupPath = pathHelper.getLookupPathForRequest(this); this.indexLookupPath = requestUri.lastIndexOf(lookupPath); this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath); if ("/".equals(lookupPath) && !"/".equals(requestUri)) { String contextPath = pathHelper.getContextPath(this); if (requestUri.equals(contextPath)) { this.indexLookupPath = requestUri.length(); this.prefixLookupPath = requestUri; } } } }
/** * Transform the given relative request path to an absolute path, * taking the path of the given request as a point of reference. * The resulting path is also cleaned from sequences like "path/..". * @param path the relative path to transform * @param request the referer request * @return the absolute request path for the given resource path */ protected String toAbsolutePath(String path, HttpServletRequest request) { String absolutePath = path; if (!path.startsWith("/")) { ResourceUrlProvider urlProvider = findResourceUrlProvider(request); Assert.state(urlProvider != null, "No ResourceUrlProvider"); String requestPath = urlProvider.getUrlPathHelper().getRequestUri(request); absolutePath = StringUtils.applyRelativePath(requestPath, path); } return StringUtils.cleanPath(absolutePath); }
private int getLookupPathIndex(HttpServletRequest request) { UrlPathHelper pathHelper = getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(request); String lookupPath = pathHelper.getLookupPathForRequest(request); return requestUri.indexOf(lookupPath); }
private void initLookupPath(ResourceUrlProvider urlProvider) { this.resourceUrlProvider = urlProvider; if (this.indexLookupPath == null) { UrlPathHelper pathHelper = this.resourceUrlProvider.getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(this); String lookupPath = pathHelper.getLookupPathForRequest(this); this.indexLookupPath = requestUri.lastIndexOf(lookupPath); this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath); if ("/".equals(lookupPath) && !"/".equals(requestUri)) { String contextPath = pathHelper.getContextPath(this); if (requestUri.equals(contextPath)) { this.indexLookupPath = requestUri.length(); this.prefixLookupPath = requestUri; } } } }
/** * Transform the given relative request path to an absolute path, * taking the path of the given request as a point of reference. * The resulting path is also cleaned from sequences like "path/..". * @param path the relative path to transform * @param request the referer request * @return the absolute request path for the given resource path */ protected String toAbsolutePath(String path, HttpServletRequest request) { String absolutePath = path; if (!path.startsWith("/")) { ResourceUrlProvider urlProvider = findResourceUrlProvider(request); Assert.state(urlProvider != null, "No ResourceUrlProvider"); String requestPath = urlProvider.getUrlPathHelper().getRequestUri(request); absolutePath = StringUtils.applyRelativePath(requestPath, path); } return StringUtils.cleanPath(absolutePath); }
private int getLookupPathIndex(HttpServletRequest request) { UrlPathHelper pathHelper = getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(request); String lookupPath = pathHelper.getLookupPathForRequest(request); return requestUri.indexOf(lookupPath); }
private void initLookupPath(ResourceUrlProvider urlProvider) { this.resourceUrlProvider = urlProvider; if (this.indexLookupPath == null) { UrlPathHelper pathHelper = this.resourceUrlProvider.getUrlPathHelper(); String requestUri = pathHelper.getRequestUri(this); String lookupPath = pathHelper.getLookupPathForRequest(this); this.indexLookupPath = requestUri.lastIndexOf(lookupPath); this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath); if ("/".equals(lookupPath) && !"/".equals(requestUri)) { String contextPath = pathHelper.getContextPath(this); if (requestUri.equals(contextPath)) { this.indexLookupPath = requestUri.length(); this.prefixLookupPath = requestUri; } } } }