private String getSiteMapItemPath(final HstSiteMapItem matchedSiteMapItem) { String path = matchedSiteMapItem.getId(); path = path.replace(WILDCARD, "*"); path = path.replace(ANY, "**"); return path; }
private void populateDescendants(HstSiteMapItem hstSiteMapItem) { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(child); } }
public static final void view(StringBuffer buf, String indent, HstSiteMapItem hstSiteMapItem) { if(hstSiteMapItem == null) { buf.append("\n").append(indent).append("+HstSiteMapItem: null"); return; } buf.append("\n").append(indent).append("+HstSiteMapItem: (").append(hstSiteMapItem.hashCode()).append(")"); String newLine = "\n" + indent + SMALL_INDENT + "-"; buf.append(newLine).append("id = ").append(hstSiteMapItem.getId()); buf.append(newLine).append("value = ").append(hstSiteMapItem.getValue()); buf.append(newLine).append("relativecontentpath = ").append(hstSiteMapItem.getRelativeContentPath()); buf.append(newLine).append("componentconfigurationid = ").append(hstSiteMapItem.getComponentConfigurationId()); buf.append(newLine).append("portletcomponentconfigurationid = ").append(hstSiteMapItem.getPortletComponentConfigurationId()); buf.append(newLine).append("iswildcard = ").append(hstSiteMapItem.isWildCard()); for(HstSiteMapItem siteMapItem : hstSiteMapItem.getChildren()) { view(buf, indent+SMALL_INDENT, siteMapItem); } }
private void populateDescendants(HstSiteMapItem hstSiteMapItem) throws ModelLoadingException { try { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); } catch (IllegalArgumentException e) { throw new ModelLoadingException("HstSiteMapItem with already existing id encountered. Not allowed to have duplicate id's within one HstSiteMap. Duplicate id = '"+hstSiteMapItem.getId()+"'" , e); } if(hstSiteMapItem.getRefId() != null) { HstSiteMapItem prevValue = siteMapDescendantsByRefId.put(hstSiteMapItem.getRefId(), hstSiteMapItem); if(prevValue != null) { log.warn("HstSiteMapItem with already existing refId encountered. Not allowed to have duplicate refId's within one HstSiteMap. Duplicate refId = '{}' for HstSiteMapItem with id='{}'. Previous HstSiteMapItem with same refId is replaced.",hstSiteMapItem.getRefId(), hstSiteMapItem.getId()); } } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(child); } }
private HstSiteMapItem contextualize(HstSiteMapItemService matchedHstSiteMapItem) { if(matchedHstSiteMapItem.isUseableInRightContextOnly()) { boolean mergeable = mergeMatchedItemWithCurrentCtx(matchedHstSiteMapItem); // if not succeeded, return null if(!mergeable) { log.debug("Cannot contextualize hstSiteMapItem '{}' for current sitemap item '{}'", matchedHstSiteMapItem.getId(), this.resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } return matchedHstSiteMapItem; } else { return matchedHstSiteMapItem; } }
private HstSiteMapItem contextualize(final HstSiteMapItemService matchedHstSiteMapItem, final Map<String,String> propertyPlaceHolderMap) { if (matchedHstSiteMapItem.isUseableInRightContextOnly()) { boolean mergeable = mergeMatchedItemWithCurrentCtx(matchedHstSiteMapItem, propertyPlaceHolderMap); // if not succeeded, return null if(!mergeable) { log.debug("Cannot contextualize hstSiteMapItem '{}' for current sitemap item '{}'", matchedHstSiteMapItem.getId(), this.resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } return matchedHstSiteMapItem; } else { return matchedHstSiteMapItem; } }
private void notFound(final String type, final String componentRenderingWindowReferenceNamespace, final ValveContext context) throws ContainerException { log.warn("Illegal request for {} URL found because there is no component for id '{}' for matched " + "sitemap item '{}'. Set 404 on response for request '{}'.", type, componentRenderingWindowReferenceNamespace, context.getRequestContext().getResolvedSiteMapItem().getHstSiteMapItem().getId(), context.getServletRequest()); try { context.getServletResponse().sendError(HttpServletResponse.SC_NOT_FOUND); } catch (IOException e) { throw new ContainerException("Unable to set 404 on response after invalid resource path.", e); } } }
private void sanitizeSiteMapItem(final HstSiteMapItem hstSiteMapItem, final HstComponentsConfiguration hstComponentsConfiguration) { HstComponentConfiguration hstComponentConfiguration = hstComponentsConfiguration.getComponentConfiguration(hstSiteMapItem.getComponentConfigurationId()); if(hstComponentConfiguration == null) { log.info("HST Configuration info: The sitemap item '{}' does not point to a HST Component.", hstSiteMapItem.getId()); } else { sanitizeHstComponentConfiguration(hstComponentConfiguration); } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { sanitizeSiteMapItem(child, hstComponentsConfiguration); } }
private HippoBean getBeanForResolvedSiteMapItem(ResolvedSiteMapItem resolvedSiteMapItem) { String base = getSiteContentBasePath(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if (relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } return getHippoBean(base, relPath); }
private void sanitizeSiteMapItem(HstSiteMapItem hstSiteMapItem) { HstComponentConfiguration hstComponentConfiguration = this.getComponentsConfiguration().getComponentConfiguration(hstSiteMapItem.getComponentConfigurationId()); if(hstComponentConfiguration == null) { log.info("HST Configuration info: The sitemap item '{}' does not point to a HST Component.", hstSiteMapItem.getId()); } else { sanitizeHstComponentConfiguration(hstComponentConfiguration); } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { sanitizeSiteMapItem(child); } }
/** * @see {@link #getFacetNavigationBean(String, String, String)} with <code>absBasePath</code> as "/"+ requestContext.getSiteContentBasePath(); */ public static HippoFacetNavigationBean getFacetNavigationBean(String relPath, String query) throws HstComponentException { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { throw new HstComponentException("Cannot call #getFacetNavigationBean without HstRequestContext"); } if(relPath == null) { log.warn("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", requestContext.getResolvedSiteMapItem().getHstSiteMapItem().getId()); return null; } String absBasePath = "/"+ requestContext.getSiteContentBasePath(); return getFacetNavigationBean(absBasePath, relPath, query); }
try { Locale locale = LocaleUtils.toLocale(localeString); log.debug("Preferred locale for request is set to '{}' by sitemap item '{}'", localeString, siteMapItem.getId()); return locale; } catch (IllegalArgumentException e) { log.warn("Invalid locale, '{}', on the sitemap item, '{}'.", localeString, siteMapItem.getId());
log.debug("The ResolvedSiteMapItemImpl does not have a component configuration id because the sitemap item '{}' does not have one", hstSiteMapItem.getId()); } else { String componentConfigurationId = hstSiteMapItem.getComponentConfigurationId();
private void resolveComponentConfiguration() { // check whether there is a more specific mapping String componentConfigurationId = resolveMappedConponentConfigurationId(); HstSite hstSite = hstSiteMapItem.getHstSiteMap().getSite(); if (componentConfigurationId == null && hstSiteMapItem.getComponentConfigurationId() == null) { log.debug("The ResolvedSiteMapItemImpl does not have a component configuration id because the sitemap item '{}' does not have one", hstSiteMapItem.getId()); } else { if (componentConfigurationId == null) { log.debug("No mapped component configuration id, getting the default componentconfiguration id"); componentConfigurationId = hstSiteMapItem.getComponentConfigurationId(); } if (componentConfigurationId != null) { final String resolvedComponentConfigurationId = (String)pp.resolveProperty("componentConfigurationId", componentConfigurationId); hstComponentConfiguration = hstSite.getComponentsConfiguration().getComponentConfiguration(resolvedComponentConfigurationId); if (hstComponentConfiguration == null) { log.warn("ResolvedSiteMapItemImpl cannot be created correctly, because the component configuration id {} cannot be found.", componentConfigurationId); } } } isComponentResolved = true; }
/** * Return a <code>HippoBean</code> when it can be found for the relativeContentPath for the <code>{@link ResolvedSiteMapItem}</code>. If there is no * relativeContentPath available in the <code>{@link ResolvedSiteMapItem}</code>, or when the relativeContentPath does not point to an existing jcr node, * <code>null</code> will be returned * @param request * @param resolvedSiteMapItem * @return A <code>HippoBean</code> or <code>null</code> when there cannot be created a content bean for this resolvedSiteMapItem */ public HippoBean getBeanForResolvedSiteMapItem(HstRequest request, ResolvedSiteMapItem resolvedSiteMapItem) { String base = getSiteContentBasePath(request); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if(relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } try { if("".equals(relPath)) { return (HippoBean) getObjectBeanManager(request).getObject("/"+base); } else { return (HippoBean) getObjectBeanManager(request).getObject("/"+base+ "/" + relPath); } } catch (ObjectBeanManagerException e) { log.error("ObjectBeanManagerException. Return null : {}", e); } return null; }
log.debug("No relative content path for '{}' so cannot lookup mapped component configuration id", hstSiteMapItem.getId()); return null;
/** * Return a <code>HippoBean</code> when it can be found for the relativeContentPath for the <code>{@link ResolvedSiteMapItem}</code>. If there is no * relativeContentPath available in the <code>{@link ResolvedSiteMapItem}</code>, or when the relativeContentPath does not point to an existing jcr node, * <code>null</code> will be returned * @param request * @param resolvedSiteMapItem * @return A <code>HippoBean</code> or <code>null</code> when there cannot be created a content bean for this resolvedSiteMapItem */ public HippoBean getBeanForResolvedSiteMapItem(HstRequest request, ResolvedSiteMapItem resolvedSiteMapItem) { final HstRequestContext requestContext = request.getRequestContext(); String base = requestContext.getSiteContentBasePath(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if(relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } try { if("".equals(relPath)) { return (HippoBean) requestContext.getObjectBeanManager().getObject("/"+base); } else { return (HippoBean) requestContext.getObjectBeanManager().getObject("/"+base+ "/" + relPath); } } catch (ObjectBeanManagerException e) { log.error("ObjectBeanManagerException. Return null : {}", e); } return null; }
String path = matchedSiteMapItem.getId(); path = path.replace("_default_", "*"); path = path.replace("_any_", "**");
if (!hstSiteMapItem.isCacheable()) { log.debug("'{}' is not cacheable because hst sitemapitem '{}' is not cacheable.", context .getServletRequest(), hstSiteMapItem.getId()); return false; "the request might be a rest request). Return if the sitemap item is cacheable.", hstSiteMapItem.getId()); return hstSiteMapItem.isCacheable();
if ((resolvedLocation == null || resolvedLocation.getPath() == null) && !resolverProperties.fallback) { log.debug("Could not resolve path '{}' for preferredItem '{}' for mount '{}'. Fallback is false. " + "Other mounts will be tried if available.", path, resolverProperties.preferredItem.getId(), tryMount); return null;