public HstLinkImpl(String path, HstSite hstSite, boolean containerResource) { this.path = PathUtils.normalizePath(path); this.hstSite = hstSite; this.containerResource = containerResource; }
StringBuilder decodedUrl = new StringBuilder(); for (int i = start; i < uriParts.length - 1; i++) { decodedUrl.append("/").append(decodePart(uriParts[i])); String name = decodePart(lastPart.substring(0, lastPart.length() - HTML_SUFFIX.length())); decodedUrl.append("/").append(decodePart(lastPart));
StringBuilder encodedPath = new StringBuilder(); for (int i = start; i < uriParts.length - 1; i++) { encodedPath.append("/").append(encodePart(uriParts[i])); } else { encodedPath.append("/").append(encodePart(uriParts[last]));
public void setPageNotFoundPath(String pageNotFoundPath){ this.pageNotFoundPath = PathUtils.normalizePath(pageNotFoundPath); }
public void setBinariesPrefix(String binariesPrefix){ this.binariesPrefix = PathUtils.normalizePath(binariesPrefix); }
public void setPath(String path) { this.path = PathUtils.normalizePath(path); }
public void setBinariesPrefix(String binariesPrefix){ this.binariesPrefix = PathUtils.normalizePath(binariesPrefix); }
public void setPageNotFoundPath(String pageNotFoundPath){ this.pageNotFoundPath = PathUtils.normalizePath(pageNotFoundPath); }
public void setPath(String path) { this.path = PathUtils.normalizePath(path); }
public static String getResourcePath(HttpServletRequest request, String contentPath) { String relPath = getResourceRelPath(request); StringBuilder resourcePathBuilder = new StringBuilder(); if (contentPath != null && !"".equals(contentPath)) { resourcePathBuilder.append('/').append(PathUtils.normalizePath(contentPath)); } if (relPath != null) { resourcePathBuilder.append('/').append(PathUtils.normalizePath(relPath)); } return resourcePathBuilder.toString(); }
/** * @param request * @return the jcr path relative to the root (not starting with / thus) */ public String getSiteContentBasePath(HstRequest request){ return PathUtils.normalizePath(getHstSite(request).getContentPath()); }
public HstLink create(String path, HstSite hstSite, boolean containerResource) { return postProcess(new HstLinkImpl(PathUtils.normalizePath(path), hstSite, containerResource)); }
/** * Returns the node with the given UUID using the session of the given request context. * * @param requestContext the request context * @param uuidParam a UUID * * @return the node with the given UUID, or null if no such node could be found. */ public static Node getNode(final HstRequestContext requestContext, final String uuidParam) { if (uuidParam == null) { log.info("UUID is null, returning null", uuidParam); return null; } final String uuid = PathUtils.normalizePath(uuidParam); try { UUID.fromString(uuid); } catch(IllegalArgumentException e) { log.info("Illegal UUID: '{}', returning null", uuidParam); return null; } try { final Session jcrSession = requestContext.getSession(); return jcrSession.getNodeByIdentifier(uuid); } catch (ItemNotFoundException e) { log.warn("Node not found: '{}', returning null", uuid); } catch (RepositoryException e) { log.warn("Error while fetching node with UUID '" + uuid + "', returning null", e); } return null; }
public HstLink create(String path, HstSite hstSite) { return postProcess(new HstLinkImpl(PathUtils.normalizePath(path), hstSite)); }
public HstLink create(final String path, final Mount mount) { final String normalizedPath = PathUtils.normalizePath(path); HstLink hstLink = null; if (normalizedPath.startsWith(BINARIES_START_PATH)) { String nodePath = normalizedPath.substring(BINARIES_START_PATH.length() -1); if (isBinaryLocation(nodePath)) { hstLink = createHstLinkForBinaryLocation(nodePath, mount); } } if (hstLink == null) { hstLink = new HstLinkImpl(normalizedPath, mount); } return postProcess(hstLink); }
public HstLink create(String path, Mount mount, boolean containerResource) { final String normalizedPath = PathUtils.normalizePath(path); HstLink hstLink = null; if (normalizedPath.startsWith(BINARIES_START_PATH)) { String nodePath = normalizedPath.substring(BINARIES_START_PATH.length() -1); if (isBinaryLocation(nodePath)) { hstLink = createHstLinkForBinaryLocation(nodePath, mount); } } if (hstLink == null) { hstLink = new HstLinkImpl(normalizedPath, mount, containerResource); } return postProcess(hstLink); }
/** * Find HippoBean for given path. If path is null or empty, site root bean will be returned * * @param path document (or folder) path relative to site-root * @return bean identified by path. Site root bean if path empty or no corresponding bean. * @deprecated use the non-static {@code doGetScopeBean()} instead. */ public static HippoBean getScopeBean(final String path) { final HstRequestContext context = RequestContextProvider.get(); final HippoBean siteBean = context.getSiteContentBaseBean(); if (!Strings.isNullOrEmpty(path)) { final String myPath = PathUtils.normalizePath(path); log.debug("Looking for bean {}", myPath); HippoBean scope = siteBean.getBean(myPath); if (scope != null) { return scope; } log.warn("Bean was null for selected path: {}", myPath); } return siteBean; }
/** * Find HippoBean for given path. If path is null or empty, site root bean will be returned. * * @param path document (or folder) path relative to site-root. * @return bean identified by path. Site root bean if path empty or no corresponding bean. */ public HippoBean doGetScopeBean(final String path) { final HstRequestContext context = RequestContextProvider.get(); final HippoBean siteBean = context.getSiteContentBaseBean(); if (!Strings.isNullOrEmpty(path)) { final String myPath = PathUtils.normalizePath(path); log.debug("Looking for bean {}", myPath); HippoBean scope = siteBean.getBean(myPath); if (scope != null) { return scope; } log.warn("Bean was null for selected path: {}", myPath); } return siteBean; }
return null; if(!relPath.equals(PathUtils.normalizePath(relPath))) { log.warn("Relative path does end or start with a slash. Removing leading and trailing slashes"); relPath = PathUtils.normalizePath(relPath);
return null; if(!relPath.equals(PathUtils.normalizePath(relPath))) { log.warn("Relative path does end or start with a slash. Removing leading and trailing slashes"); relPath = PathUtils.normalizePath(relPath);