/** * @param session the {@link Session} * @return the {@link HstQueryManager} * @see {@link #getQueryManager(HstRequestContext)} and {@link #getQueryManager(HstRequest)} * @deprecated since 7.9.0 : use {@link org.hippoecm.hst.core.request.HstRequestContext#getQueryManager(Session)} instead */ @Deprecated public HstQueryManager getQueryManager(Session session) { return RequestContextProvider.get().getQueryManager(session); }
@Override public HstSiteMapItem getHstSiteMapItem() { if (siteMapItem != null) { return siteMapItem.orElse(null); } final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { return null; } return resolveSiteMapItem(requestContext); }
private HstSite getActiveHstSite() { if (branches.isEmpty() || delegatingHstSiteProvider == null) { return master; } return delegatingHstSiteProvider.getHstSite(this, RequestContextProvider.get()); }
private void disposeHstRequestContext() { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext != null) { requestContextComponent.release(requestContext); } }
public String getHostGroupNameForCmsHost() { String hostGroupNameForCmsHost = (String)RequestContextProvider.get().getAttribute(HOST_GROUP_NAME_FOR_CMS_HOST); if (hostGroupNameForCmsHost == null) { throw new IllegalStateException("For cms rest request there should be a request context attr for '"+HOST_GROUP_NAME_FOR_CMS_HOST+"' " + "but wasn't found."); } return hostGroupNameForCmsHost; } public void setChannelManager(final ChannelManager channelManager) {
/** * Return the current {@link AggregatedPageModel} object. * @return the current {@link AggregatedPageModel} object */ public static AggregatedPageModel getCurrentAggregatedPageModel() { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext != null) { return (AggregatedPageModel) requestContext.getAttribute(AGGREGATED_PAGE_MODEL_ATTR); } return null; }
/** * Set the current {@link AggregatedPageModel} object. * @param aggregatedPageModel the current {@link AggregatedPageModel} object */ public static void setCurrentAggregatedPageModel(AggregatedPageModel aggregatedPageModel) { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { throw new IllegalStateException("HstRequestContext is not available."); } requestContext.setAttribute(AGGREGATED_PAGE_MODEL_ATTR, aggregatedPageModel); }
/** * Exit from the last top level bean's serialization sub-context. */ public static String endTopLevelContentBean() { final HstRequestContext requestContext = RequestContextProvider.get(); Stack<String> baseModelIdStack = (Stack<String>) requestContext .getAttribute(TOP_LEVEL_BEAN_IDS_STACK_ATTR_NAME); if (baseModelIdStack == null || baseModelIdStack.empty()) { throw new IllegalStateException("No current top level content bean representation ID in the internal stack."); } return baseModelIdStack.pop(); }
private String getHostGroupNameFromContext() throws ChannelException { // FIXME: move all modification methods to the 'cmsrest' module and use the // CmsRestSecurityValve#HOST_GROUP_NAME_FOR_CMS_HOST constant instead of the hardcoded string "HOST_GROUP_NAME_FOR_CMS_HOST" final String hostGroupForCmsHost = (String) RequestContextProvider.get().getAttribute("HOST_GROUP_NAME_FOR_CMS_HOST"); if (StringUtils.isEmpty(hostGroupForCmsHost)) { throw new ChannelException("There is no hostgroup for cms host available. Cannot get or create virtual hosts"); } return hostGroupForCmsHost; }
public <T extends HippoBean> T getHippoBeanForPath(final String documentPath, Class<T> beanMappingClass) { if (!Strings.isNullOrEmpty(documentPath)) { final HstRequestContext context = RequestContextProvider.get(); final HippoBean root = context.getSiteContentBaseBean(); return root.getBean(documentPath, beanMappingClass); } return null; }
/** * Clear all the <code>HstRequestContext} specific attributes regarding Content Serialization Context. */ public static void clear() { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext != null) { requestContext.removeAttribute(PHASE_ATTR); requestContext.removeAttribute(AGGREGATED_PAGE_MODEL_ATTR); } } }
/** * @return The {@code HstQuery} for this {@code HstQueryBuilder} where the backing {@code HstQueryManager} is taken * from {@link HstRequestContext#getQueryManager()} * @throws RuntimeQueryException in case the #build results in a {@link QueryException} or {@link FilterException} */ public HstQuery build() throws RuntimeQueryException { final HstRequestContext requestContext = RequestContextProvider.get(); return build(requestContext.getQueryManager()); }
/** * Clear all the HippoBeanSerializationContext related attributes. */ public static void clear() { final HstRequestContext requestContext = RequestContextProvider.get(); requestContext.removeAttribute(TOP_LEVEL_BEAN_IDS_STACK_ATTR_NAME); requestContext.removeAttribute(BEAN_MODEL_SET_MAP_ATTR_NAME); }
private String getContentPath() { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext != null) { return this.pageComposerContextService.getEditingMount().getContentPath(); } return StringUtils.EMPTY; }
protected void setComponentId(final HstRequest request, final HstResponse response) { if (RequestContextProvider.get().isCmsRequest()) { request.setAttribute(REQUEST_ATTR_COMPONENT_ID, UUID.randomUUID().toString()); } else { request.setAttribute(REQUEST_ATTR_COMPONENT_ID, response.getNamespace()); } }
public void unlock() throws RepositoryException { if (RequestContextProvider.get() != null) { if (!node.isNodeType(HstNodeTypes.NODETYPE_HST_CONTAINERITEMCOMPONENT)) { throw new IllegalStateException("Node to be saved must be of type '" + HstNodeTypes.NODETYPE_HST_CONTAINERITEMCOMPONENT + "' but " + "was of type '" + node.getPrimaryNodeType().getName() + "'. Skip save"); } containerItemHelper.releaseLock(node); } }
/** * See {@link #getComponentParameters()}, but now, only resolved parameter map of parameters is returned that is directly on * the HstComponenConfiguration, thus, no inheritance is applied * @return Map of all parameters, and when no parameters present, return empty map. */ public Map<String,String> getComponentLocalParameters(){ return this.getComponentConfiguration().getLocalParameters(RequestContextProvider.get().getResolvedSiteMapItem()); }
protected void includeLocalURL(Writer writer, URI uri, HstContainerURL localContainerURL) throws IOException { if (localContainerURL.getComponentRenderingWindowReferenceNamespace() != null || localContainerURL.getResourceWindowReferenceNamespace() != null) { includeLocalESIPipelineURL(writer, uri, localContainerURL); } else if (RequestContextProvider.get().getVirtualHost().getVirtualHosts().isHstFilterExcludedPath(uri.getPath())) { includeLocalDispatchURL(writer, uri, localContainerURL); } else { log.warn("Ignoring ESI Include Tag. ESI Include Tag for a local HST navigational " + "URL (neither componentRendering nor resource URL) is not supported yet: '{}'.", uri); } }
@Override public String marshal(HippoHtml html) throws Exception { if (html == null) { return null; } final HstRequestContext context = RequestContextProvider.get(); return new SimpleContentRewriter().rewrite(html.getContent(), html.getNode(), context); }
@Override public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException { super.doBeforeRender(request, response); setComponentId(request, response); final EssentialsGoogleMapsComponentInfo paramInfo = getComponentParametersInfo(request); request.setAttribute(REQUEST_ATTR_PARAM_INFO, paramInfo); request.setAttribute("cmsrequest", RequestContextProvider.get().isCmsRequest()); } }