/** * Create a HstLinkResolver instance with the current context <code>resolvedSiteMapItem</code>. The {@link HstSite} is taken from this context * @param node * @param resolvedSiteMapItem */ HstLinkResolver(Node node, ResolvedSiteMapItem resolvedSiteMapItem){ this.node = node; this.resolvedSiteMapItem = resolvedSiteMapItem; HstSiteMap hstSiteMap = resolvedSiteMapItem.getHstSiteMapItem().getHstSiteMap(); hstSite = (HstSiteService)hstSiteMap.getSite(); }
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); }
if (resolvedSiteMapItem.getPathInfo().equals(resolvedMount.getMount().getPageNotFound())) { siteMapItemRefIdOrPath, resolvedSiteMapItem.getHstSiteMapItem()); throw new IllegalStateException(msg); if (StringUtils.isEmpty(resolvedSiteMapItem.getRelativeContentPath())) { if (resolvedSiteMapItem.getHstSiteMapItem().isExplicitPath()) { return SiteMapTreePickerRepresentation.representExpandedParentTree(pageComposerContextService, resolvedSiteMapItem.getHstSiteMapItem()); "created for it.", siteMapItemRefIdOrPath, resolvedSiteMapItem.getHstSiteMapItem()); throw new IllegalStateException(msg); final String selectedPath = contentRootPath + "/" + resolvedSiteMapItem.getRelativeContentPath(); final ExpandedNodeHierarchy expandedNodeHierarchy = createExpandedNodeHierarchy(jcrSession, contentRootPath, Collections.singletonList(selectedPath));
requestContext.getResolvedSiteMapItem().getHstSiteMapItem(), resolvedSiteMapItem.getHstSiteMapItem()); requestContext.setResolvedSiteMapItem(resolvedSiteMapItem); if (resolvedSiteMapItem.getErrorCode() > 0) { try { log.info("The resolved sitemap item for {} has error status: {}", containerRequest , Integer.valueOf(resolvedSiteMapItem.getErrorCode())); res.sendError(resolvedSiteMapItem.getErrorCode()); if (resolvedSiteMapItem.getStatusCode() > 0) { log.debug("Setting the status code to '{}' for '{}' because the matched sitemap item has specified the status code" , String.valueOf(resolvedSiteMapItem.getStatusCode()), containerRequest.getRequestURL().toString()); res.setStatus(resolvedSiteMapItem.getStatusCode()); log.info("Start processing request for pipeline '{}' for {}", resolvedSiteMapItem.getNamedPipeline(), containerRequest); writeDefaultResponseHeaders(requestContext, res); requestProcessor.processRequest(this.requestContainerConfig, requestContext, containerRequest, res, resolvedSiteMapItem.getNamedPipeline()); containerRequest.removeAttribute(ContainerConstants.HST_FORWARD_PATH_INFO); resolvedSiteMapItem = resolvedSiteMapItem.getResolvedMount().matchSiteMapItem(forwardPathInfo); if(resolvedSiteMapItem == null) {
private boolean isSupportedScheme(final HstMutableRequestContext requestContext, final ResolvedSiteMapItem resolvedSiteMapItem, final String farthestRequestScheme) { if (requestContext.isCmsRequest()) { // cms request always supported as piggybacking on cms host return true; } final HstSiteMapItem hstSiteMapItem = resolvedSiteMapItem.getHstSiteMapItem(); if (hstSiteMapItem.isSchemeAgnostic()) { return true; } if (hstSiteMapItem.getScheme().equals(farthestRequestScheme)) { return true; } if ("https".equals(farthestRequestScheme) && resolvedSiteMapItem.getResolvedMount().getMount().getVirtualHost().isCustomHttpsSupported()) { // although sitemap item indicates http, https is approved by default to be rendered return true; } return false; }
private boolean isSiteMapItemAndComponentConfigCacheable(final ResolvedSiteMapItem resolvedSitemapItem, final ValveContext context) throws ContainerException { final HstSiteMapItem hstSiteMapItem = resolvedSitemapItem.getHstSiteMapItem(); if (!hstSiteMapItem.isCacheable()) { log.debug("'{}' is not cacheable because hst sitemapitem '{}' is not cacheable.", context if (resolvedSitemapItem.getHstComponentConfiguration() == null) { log.debug("Matched sitemap item '{}' does not have a (resolvable) component configuration (for example because " + "the request might be a rest request). Return if the sitemap item is cacheable.", hstSiteMapItem.getId()); if (!resolvedSitemapItem.getHstComponentConfiguration().isCompositeCacheable()) { log.debug("'{}' is not cacheable because hst component '{}' is not cacheable.", context .getServletRequest(), resolvedSitemapItem.getHstComponentConfiguration() .getId()); return false; } else if (!resolvedSitemapItem.getHstComponentConfiguration().isCompositeCacheable()) { log.debug("'{}' is not cacheable because hst component '{}' is not cacheable.", context .getServletRequest(), resolvedSitemapItem.getHstComponentConfiguration().getId()); return false;
HstSiteMapItemService currentAncestorOrSelf = (HstSiteMapItemService)this.resolvedSiteMapItem.getHstSiteMapItem(); while(currentAncestorOrSelf != null) { if(currentAncestorOrSelf.isWildCard() || currentAncestorOrSelf.containsWildCard() || currentAncestorOrSelf.isAny() || currentAncestorOrSelf.containsAny()) { Properties currentCtxProperties = this.resolvedSiteMapItem.getParameters(); Map<String, String> propertiesToMerge = new HashMap<String,String>(); for(HstSiteMapItemService matchedAncestorItem : matchedAncestorOrSelfWildcardList) {
protected String resolveEmbeddedDispatchURL(PortletRequest request, PortletResponse response) { HstPortalContextProvider pcp = getPortalContextProvider(request); HstPortalRequestContext prc = pcp != null ? pcp.getPortalRequestContext(request) : null; ResolvedSiteMapItem rsmi = prc != null ? prc.getResolvedSiteMapItem() : null; HstComponentConfiguration hcc = rsmi != null ? rsmi.getHstComponentConfiguration() : null; if (hcc != null) { HstMutablePortletRequestContext hrc = createHstRequestContext(request, response); hrc.setTargetComponentPath(request.getPreferences().getValue(HST_COMPONENT_PATH, defaultHstComponentPath)); hrc.setEmbeddingContextPath(prc.getEmbeddingContextPath()); hrc.setResolvedEmbeddingSiteMount(prc.getResolvedEmbeddingSiteMount()); hrc.setResolvedSiteMount(rsmi.getResolvedSiteMount()); hrc.setResolvedSiteMapItem(rsmi); return new StringBuilder(rsmi.getResolvedSiteMount().getResolvedMountPath()).append("/").append(rsmi.getPathInfo()).toString(); } return null; } }
ResolvedSiteMount resolvedSiteMount = hstRequest.getRequestContext().getResolvedSiteMapItem().getResolvedSiteMount(); if(preferItemId != null) { if(siteMapItem != null) { log.warn("preferItemId attr is added, but also 'preferItemByPath' or 'siteMapItem'. This is double. Skipping preferItemId attr"); } else { siteMapItem = hstRequest.getRequestContext().getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSiteMapItemById(preferItemId); if(siteMapItem == null) { log.warn("Cannot find sitemap item with id '{}' for site '{}'", preferItemId, resolvedSiteMount.getSiteMount().getName()); try { ResolvedSiteMapItem resolvedItem = hstRequest.getRequestContext().getSiteMapMatcher().match(preferPath, resolvedSiteMount); siteMapItem = resolvedItem.getHstSiteMapItem(); } catch (NotFoundException e) { log.warn("Cannot resolve a sitemap item for '{}' for site '{}'", preferPath, resolvedSiteMount.getSiteMount().getName());
protected HippoFacetNavigationBean getFacetNavigationBean(final HstRequestContext context, String path, String query) { if (Strings.isNullOrEmpty(path)) { log.warn("Facetpath was empty {}", path); return null; } ResolvedSiteMapItem resolvedSiteMapItem = context.getResolvedSiteMapItem(); String resolvedContentPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); String parsedQuery = cleanupSearchQuery(query); HippoFacetNavigationBean facNavBean; if (!StringUtils.isBlank(resolvedContentPath) && !resolvedContentPath.startsWith("/") && context.getSiteContentBaseBean().getBean(resolvedContentPath, HippoFacetNavigationBean.class) != null) { facNavBean = ContentBeanUtils.getFacetNavigationBean(resolvedContentPath, parsedQuery); } else { facNavBean = ContentBeanUtils.getFacetNavigationBean(path, parsedQuery); } return facNavBean; } }
String pathInfo = (resolvedSiteMapItem == null ? "" : resolvedSiteMapItem.getPathInfo()); destinationLink = requestContext.getHstLinkCreator().create(pathInfo, destLinkMount); } catch (Exception linkEx) {
if (resolvedSiteMapItem.getErrorCode() > 0) { try { if (logger.isDebugEnabled()) { logger.debug("The resolved sitemap item for {} has error status: {}", requestContext.getBaseURL().getRequestPath(), Integer.valueOf(resolvedSiteMapItem.getErrorCode())); res.sendError(resolvedSiteMapItem.getErrorCode()); HstServices.getRequestProcessor().processRequest(this.requestContainerConfig, requestContext, req, res, resolvedSiteMapItem.getNamedPipeline()); req.removeAttribute(ContainerConstants.HST_FORWARD_PATH_INFO); resolvedSiteMapItem = resolvedSiteMapItem.getResolvedSiteMount().matchSiteMapItem(forwardPathInfo); if(resolvedSiteMapItem == null) {
/** * Resolves with the help of the current resolvedSiteMapItem to a new sitemap item with path <code>pathInfo</code> * @param request * @param response * @param currentResolvedSiteMapItem * @param pathInfo * @throws MatchException when the <code>pathInfo</code> cannot be matched * @return a new ResolvedSiteMapItem */ public ResolvedSiteMapItem matchSiteMapItem(HttpServletRequest request, HttpServletResponse response, ResolvedSiteMapItem currentResolvedSiteMapItem, String pathInfo) throws MatchException { return currentResolvedSiteMapItem.getResolvedSiteMount().matchSiteMapItem(pathInfo); }
HstComponentConfiguration rootComponentConfig = resolvedSiteMapItem.getHstComponentConfiguration(); if (!requestContext.isEmbeddedRequest() && requestContext.isPortletContext() && resolvedSiteMapItem.getPortletHstComponentConfiguration() != null) { rootComponentConfig = resolvedSiteMapItem.getPortletHstComponentConfiguration(); if (hcc != resolvedSiteMapItem.getHstComponentConfiguration()) { do { contextNamespaceBuilder.insert(0, hcc.getReferenceName()); hcc = hcc.getParent(); if (hcc == resolvedSiteMapItem.getHstComponentConfiguration()) { break;
ResolvedMount resolvedMount = requestContext.getResolvedSiteMapItem().getResolvedMount(); if(preferItemId != null) { if(siteMapItem != null) { log.warn("preferItemId attr is added, but also 'preferItemByPath' or 'siteMapItem'. This is double. Skipping preferItemId attr"); } else { siteMapItem = requestContext.getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSiteMapItemByRefId(preferItemId); if(siteMapItem == null) { log.warn("Cannot find sitemap item with id '{}' for site '{}'", preferItemId, resolvedMount.getMount().getName()); try { ResolvedSiteMapItem resolvedItem = requestContext.getSiteMapMatcher().match(preferPath, resolvedMount); siteMapItem = resolvedItem.getHstSiteMapItem(); } catch (NotFoundException e) { log.warn("Cannot resolve a sitemap item for '{}' for site '{}'", preferPath, resolvedMount.getMount().getName());
HstComponentConfiguration rootComponentConfig = resolvedSiteMapItem.getHstComponentConfiguration(); resolvedSiteMapItem.getHstSiteMapItem().getQualifiedId())); resolvedSiteMapItem.getHstSiteMapItem().getQualifiedId()));
HstSiteMapItemService currentAncestorOrSelf = (HstSiteMapItemService)resolvedSiteMapItem.getHstSiteMapItem(); while(currentAncestorOrSelf != null) { if(currentAncestorOrSelf.isWildCard() || currentAncestorOrSelf.containsWildCard() || currentAncestorOrSelf.isAny() || currentAncestorOrSelf.containsAny()) { Properties currentCtxProperties = resolvedSiteMapItem.getParameters(); Map<String, String> propertiesToMerge = new HashMap<>(); for(HstSiteMapItemService matchedAncestorItem : matchedAncestorOrSelfWildcardList) {
/** * @see {@link #getFacetNavigationBean(String, String, String)} with <code>absBasePath</code> as "/"+ requestContext.getSiteContentBasePath() and * <code>relPath </code> as requestContext.getResolvedSiteMapItem().getRelativeContentPath() */ public static HippoFacetNavigationBean getFacetNavigationBean(String query) throws HstComponentException { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { throw new HstComponentException("Cannot call #getFacetNavigationBean without HstRequestContext"); } ResolvedSiteMapItem resolvedSiteMapItem = requestContext.getResolvedSiteMapItem(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); return getFacetNavigationBean(relPath, query); }
String currentPathInfo = resolvedSiteMapItem.getPathInfo(); String siteMenuItemToMapPath = PathUtils.normalizePath(hstSiteMenuItemConfiguration.getSiteMapItemPath());
/** * @param resolvedSiteMapItem * @return the HstURLFactory */ public HstURLFactory getURLFactory(ResolvedSiteMapItem resolvedSiteMapItem) { HstURLFactory factory = resolvedSiteMapItem.getResolvedSiteMount().getResolvedVirtualHost().getVirtualHost().getVirtualHosts().getVirtualHostsManager().getUrlFactory(); return factory; } }