@Override protected Map<String, LinkModel> createLinksMap(final HstRequestContext requestContext, final HippoGalleryImageBean imageBean) throws Exception { final Mount siteMount = getSiteMountForCurrentPageModelApiRequest(requestContext); if (siteMount == null) { log.info("Cannot add linkes properly as there's no proper site mount for this request."); return null; } final Map<String, LinkModel> linksMap = new LinkedHashMap<>(); final HstLink imageHstLink = requestContext.getHstLinkCreator().create(imageBean.getNode(), siteMount); final LinkModel linkModel = LinkModel.convert(imageHstLink, requestContext); linksMap.put(LINK_NAME_SITE, linkModel); return linksMap; } }
HstLinkCreator linkCreator = requestContext.getHstLinkCreator(); HstSiteMap siteMap = requestContext.getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap();
return reqContext.getHstLinkCreator().create(path, reqContext.getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSite()); } else { return reqContext.getHstLinkCreator().create(mirrorNode, reqContext.getResolvedSiteMapItem()); } else { log.warn("Cannot find node '{}' for internal link for document '{}'. Cannot create link", path, node.getPath());
HstLink link = requestContext.getHstLinkCreator().create(current.getNode(), requestContext,null, true, true);
public String getLink() { final HstRequestContext context = RequestContextProvider.get(); return context.getHstLinkCreator().create("/", context.getResolvedMount().getMount()).toUrlForm(context, true); }
HstLink link = reqContext.getHstLinkCreator().create(current.getNode(), reqContext.getResolvedSiteMapItem());
this.link = reqContext.getHstLinkCreator().createCanonical(hippoBean.getNode(), reqContext.getResolvedSiteMapItem(), preferSiteMapItem); } else { this.link = reqContext.getHstLinkCreator().create(hippoBean.getNode(), reqContext.getResolvedSiteMapItem(), preferSiteMapItem, fallback); VirtualHost virtualHost = reqContext.getVirtualHost(); boolean containerResource = (virtualHost != null && virtualHost.getVirtualHosts().isExcluded(this.path)); this.link = reqContext.getHstLinkCreator().create(this.path, site, containerResource);
destinationLink = requestContext.getHstLinkCreator().create(pathInfo, destLinkMount); } catch (Exception linkEx) { if (log.isDebugEnabled()) { httpSession.setAttribute(DESTINATION_ATTR_NAME, destinationLink.toUrlForm(requestContext, true)); httpSession.setAttribute(SECURITY_EXCEPTION_ATTR_NAME, securityException); String formLoginURL = requestContext.getHstLinkCreator().create(formLoginPage, destLinkMount).toUrlForm(requestContext, true); servletResponse.sendRedirect(formLoginURL); return;
this.hstSiteMapItemPath = hstSiteMenuItemConfiguration.getSiteMapItemPath(); this.externalLink = hstSiteMenuItemConfiguration.getExternalLink(); this.linkCreator = hstRequestContext.getHstLinkCreator(); this.name = hstSiteMenuItemConfiguration.getName(); this.depth = hstSiteMenuItemConfiguration.getDepth();
HstLink hstLink = requestContext.getHstLinkCreator().create(canonicalUuid, getJcrSession(servletRequest), parentResolvedSiteMapItem); final HstContainerURL baseURL = requestContext.getBaseURL(); HstContainerURL adjustedBaseURL =
new String[] { mountAlias, mountType, path }); Mount requestedMount = reqContext.getResolvedMount().getMount(); link = reqContext.getHstLinkCreator().create(HstSiteMapUtils.getPath(requestedMount, requestedMount.getPageNotFound()), requestedMount); link = reqContext.getHstLinkCreator().create(hippoBean.getNode(), mount); link = reqContext.getHstLinkCreator().createCanonical(hippoBean.getNode(), reqContext, preferSiteMapItem); } else { link = reqContext.getHstLinkCreator().create(hippoBean.getNode(), reqContext, preferSiteMapItem, fallback, navigationStateful); link = reqContext.getHstLinkCreator().create(pathInfo, mount); link = reqContext.getHstLinkCreator().createByRefId(siteMapItemRefId, mount);
HstLink link = reqContext.getHstLinkCreator().create(fullWebFilePath, resolvedMount.getMount(), true); String urlString = link.toUrlForm(reqContext, fullyQualified);
/** * Add links to content bean model. * @param contentBeanModel content bean model */ private void addLinksToContent(final HstRequestContext requestContext, final HippoBeanWrapperModel contentBeanModel) { final HippoBean hippoBean = contentBeanModel.getBean(); if (!hippoBean.isHippoDocumentBean() && !hippoBean.isHippoFolderBean()) { return; } final Mount selfMount = requestContext.getResolvedMount().getMount(); final HstLink selfLink = requestContext.getHstLinkCreator().create(hippoBean.getNode(), selfMount); if (selfLink == null) { return; } contentBeanModel.putLink(LINK_NAME_SITE, LinkModel.convert(selfLink, requestContext)); }
response.setStatus(HttpServletResponse.SC_NOT_FOUND); if (bean != null) { final HstLinkCreator hstLinkCreator = context.getHstLinkCreator(); final HstLink hstLink = hstLinkCreator.create(bean.getNode(), context); try {
final HstLinkCreator linkCreator = requestContext.getHstLinkCreator();
/** * @param hstLink * @return the {@code hstLink} converted to a {@link LinkModel} */ public static LinkModel convert(final HstLink hstLink, final HstRequestContext requestContext) { final Mount linkMount = hstLink.getMount(); // admittedly a bit of a dirty check to check on PageModelPipeline. Can this be improved? if (PAGE_MODEL_PIPELINE_NAME.equals(linkMount.getNamedPipeline())) { final Mount siteMount = linkMount.getParent(); if (siteMount == null) { log.info("Expected a 'PageModelPipeline' always to be nested below a parent site mount. This is not the " + "case for '{}'. Return the link model of the current hst link instead of relative to the parent " + "mount.", linkMount); return new LinkModel(hstLink.toUrlForm(requestContext, false), "external"); } // since the selfLink could be resolved, the site link also must be possible to resolve final HstLink siteLink = requestContext.getHstLinkCreator().create(hstLink.getPath(), siteMount); if (siteLink != null) { final String linkType = getLinkType(requestContext, siteLink); return new LinkModel(siteLink.toUrlForm(requestContext, false), linkType); } log.warn("Unexpectedly could not resolve a site link for '{}'. Return LinkModel for hst link.", hstLink); return new LinkModel(hstLink.toUrlForm(requestContext, false), "external"); } if (requestContext.getResolvedMount().getMount() == hstLink.getMount()) { return new LinkModel(hstLink.toUrlForm(requestContext, false), "internal"); } return new LinkModel(hstLink.toUrlForm(requestContext, false), "external"); }
this.hstSiteMenuItemConfiguration = hstSiteMenuItemConfiguration; this.externalLink = hstSiteMenuItemConfiguration.getExternalLink(); this.linkCreator = hstRequestContext.getHstLinkCreator(); this.name = hstSiteMenuItemConfiguration.getName(); this.depth = hstSiteMenuItemConfiguration.getDepth();
/** * Add links to the page model. * @param pageModel the aggregated page model instance */ private void addLinksToPageModel(IdentifiableLinkableMetadataBaseModel pageModel) { final HstRequestContext requestContext = RequestContextProvider.get(); final HstLinkCreator linkCreator = requestContext.getHstLinkCreator(); final HstSiteMapItem siteMapItem = requestContext.getResolvedSiteMapItem().getHstSiteMapItem(); final Mount selfMount = requestContext.getResolvedMount().getMount(); final HstLink selfLink = linkCreator.create(siteMapItem, selfMount); pageModel.putLink(ContainerConstants.LINK_NAME_SELF, new LinkModel(selfLink.toUrlForm(requestContext, true))); final Mount siteMount = selfMount.getParent(); if (siteMount != null) { final HstLink siteLink = linkCreator.create(siteMapItem, siteMount); pageModel.putLink(ContainerConstants.LINK_NAME_SITE, new LinkModel(siteLink.toUrlForm(requestContext, true))); } else { log.warn("Expected a 'PageModelPipeline' always to be nested below a parent site mount. This is not the " + "case for '{}'. Cannot add site links", selfMount); } }
public ComponentRepresentation represent(HstComponentConfiguration componentConfiguration, Mount mount) { id = componentConfiguration.getCanonicalIdentifier(); name = componentConfiguration.getName(); path = componentConfiguration.getCanonicalStoredLocation(); final HstComponentConfiguration parent = componentConfiguration.getParent(); if (parent != null) { parentId = parent.getCanonicalIdentifier(); } this.inherited = componentConfiguration.isInherited(); this.prototype = componentConfiguration.isPrototype(); hasContainerInPageDefinition = hasContainerInPageDefinition(componentConfiguration, path); componentClassName = componentConfiguration.getComponentClassName(); template = componentConfiguration.getRenderPath(); type = componentConfiguration.getComponentType().toString(); xtype = componentConfiguration.getXType(); label = componentConfiguration.getLabel(); iconPath = componentConfiguration.getIconPath(); // still need to create the iconURL from the iconPath if (StringUtils.isNotBlank(iconPath)) { HstRequestContext requestContext = RequestContextProvider.get(); iconURL = requestContext.getHstLinkCreator().create(iconPath, mount, true).toUrlForm(requestContext, false); } if (parent != null && parent.getLastModified() != null) { lastModifiedTimestamp = parent.getLastModified().getTimeInMillis(); } return this; }