public Credentials getDefaultCredentials(HstRequestContext requestContext) { if (defaultCredentialsForPreviewMode != null && requestContext.isPreview()) { return defaultCredentialsForPreviewMode; } return defaultCredentials; }
public Credentials getDefaultCredentials(HstRequestContext requestContext) { if (defaultCredentialsForPreviewMode != null && requestContext.isPreview()) { return defaultCredentialsForPreviewMode; } return defaultCredentials; }
/** * Is this a request in preview? */ protected boolean isPreview(final HstRequest request) { return request.getRequestContext().isPreview(); }
/** * @return <code>true</code> when this request is matched to a preview site * @see Mount#isPreview() */ public boolean isPreview(HstRequest request) { return request.getRequestContext().isPreview(); }
public boolean isPreview(HstRequest request) { return request.getRequestContext().isPreview(); }
if (bundleRegistry != null) { if (locale == null) { bundle = (requestContext.isPreview() ? bundleRegistry.getBundleForPreview(bundleId) : bundleRegistry.getBundle(bundleId)); } else { bundle = (requestContext.isPreview() ? bundleRegistry.getBundleForPreview(bundleId, locale) : bundleRegistry.getBundle(bundleId, locale));
if (RequestContextProvider.get().isPreview() ) { query.append(" and (@").append(HippoNodeType.HIPPO_AVAILABILITY).append("='preview'").append(")"); } else {
/** * Write the aggregated output to the client. e.g, by flushing the {@code rootRenderingWindow} by default. * @param context {@link ValveContext} instance * @param rootRenderingWindow the root rendering {@link HstComponentWindow} instance * @throws ContainerException if HST Container exception occurs */ protected void writeAggregatedOutput(final ValveContext context, final HstComponentWindow rootRenderingWindow) throws ContainerException { final HstRequestContext requestContext = context.getRequestContext(); try { // add the X-HST-VERSION as a response header if we are in preview: boolean isPreviewOrCmsRequest = requestContext.isPreview() || requestContext.isCmsRequest(); if (isPreviewOrCmsRequest) { final HttpServletResponse servletResponse = context.getServletResponse(); setNoCacheHeaders(servletResponse); if (requestContext.getResolvedMount().getMount().isVersionInPreviewHeader()) { servletResponse.setHeader("X-HST-VERSION", HstServices.getImplementationVersion()); } } // flush root component window content. // note that the child component's contents are already flushed into the root component's response state. rootRenderingWindow.getResponseState().flush(); } catch (Exception e) { if (log.isDebugEnabled()) { log.warn("Exception during flushing the response state.", e); } else if (log.isWarnEnabled()) { log.warn("Exception during flushing the response state. {}", e.toString()); } } }
if(!hstRequestContext.isPreview()) { log.debug("Skipping surf & edit link because not in preview."); return EVAL_PAGE;
public Credentials getDefaultCredentials(HstRequestContext requestContext) { Credentials credentials = super.getDefaultCredentials(requestContext); if (credentials instanceof SimpleCredentials) { String siteName = requestContext.getResolvedSiteMapItem().getResolvedMount().getMount().getHstSite().getName(); String userID = ((SimpleCredentials) credentials).getUserID(); String userIDWithSiteName = userID + siteNameSeparator + siteName; char [] password = ((SimpleCredentials) credentials).getPassword(); if (requestContext.isPreview()) { credentials = defaultCredentialsForPreviewModeCache.get(userIDWithSiteName); if (credentials == null) { credentials = new SimpleCredentials(userIDWithSiteName, password); defaultCredentialsForPreviewModeCache.put(userIDWithSiteName, credentials); } } else { credentials = defaultCredentialsCache.get(userIDWithSiteName); if (credentials == null) { credentials = new SimpleCredentials(userIDWithSiteName, password); defaultCredentialsCache.put(userIDWithSiteName, credentials); } } } return credentials; }
public Credentials getDefaultCredentials(HstRequestContext requestContext) { Credentials credentials = super.getDefaultCredentials(requestContext); if (credentials instanceof SimpleCredentials) { String siteName = requestContext.getResolvedSiteMapItem().getResolvedSiteMount().getSiteMount().getHstSite().getName(); String userID = ((SimpleCredentials) credentials).getUserID(); String userIDWithSiteName = userID + siteNameSeparator + siteName; char [] password = ((SimpleCredentials) credentials).getPassword(); if (requestContext.isPreview()) { credentials = defaultCredentialsForPreviewModeCache.get(userIDWithSiteName); if (credentials == null) { credentials = new SimpleCredentials(userIDWithSiteName, password); defaultCredentialsForPreviewModeCache.put(userIDWithSiteName, credentials); } } else { credentials = defaultCredentialsCache.get(userIDWithSiteName); if (credentials == null) { credentials = new SimpleCredentials(userIDWithSiteName, password); defaultCredentialsCache.put(userIDWithSiteName, credentials); } } } return credentials; }
if (requestContext.isPreview() && requestContext.getResolvedSiteMount().getSiteMount().isVersionInPreviewHeader()) { rootWindow.getResponseState().addHeader("X-HST-VERSION", HstServices.getImplementationVersion());
@Override public void invoke(ValveContext context) throws ContainerException { final HstRequestContext requestContext = context.getRequestContext(); final String componentRenderingWindowReferenceNamespace = requestContext.getBaseURL().getComponentRenderingWindowReferenceNamespace(); if (componentRenderingWindowReferenceNamespace == null) { // not a compoment rendering request, so skip it.. context.invokeNext(); return; } final HstComponentWindow window = context.getRootComponentWindow(); final HttpServletResponse servletResponse = requestContext.getServletResponse(); if (requestContext.isCmsRequest() || requestContext.isPreview()) { setNoCacheHeaders(servletResponse); } if (!window.getComponentInfo().isStandalone()) { // set the rendering window firsst context.setRootComponentRenderingWindow(window); // set the sitemap item root window as the root window because the backing componentInfo is standalone HstComponentWindow root = window; while(root.getParentWindow() != null) { root = root.getParentWindow(); } context.setRootComponentWindow(root); } context.invokeNext(); }