private ResolvedMount decoratedResolvedMount(final ResolvedMount resolvedMount) { if (resolvedMount == null) { return null; } if (!(resolvedMount instanceof MutableResolvedMount)) { String msg = String.format("Resolved mount '%s' expected to be a MutableResolvedMount but was not.", resolvedMount.getMount().toString()); throw new IllegalStateException(msg); } ((MutableResolvedMount)resolvedMount).setMount(decorateMountAsPreview(resolvedMount.getMount())); return resolvedMount; } }
@Deprecated @Override public ResolvedSiteMapItem matchSiteMapItem(final HstContainerURL hstContainerURL) throws MatchException { // don't delegate the matching of mount since we need a decorated! ResolvedMount decoratedMount = matchMount(hstContainerURL.getHostName(), hstContainerURL.getContextPath(), hstContainerURL.getRequestPath()); ResolvedSiteMapItem resolvedSiteMapItem = decoratedMount.matchSiteMapItem(hstContainerURL.getPathInfo()); return resolvedSiteMapItem; }
private void setHstServletPath(final GenericHttpServletRequestWrapper request, final ResolvedMount resolvedMount) { if (resolvedMount.getMatchingIgnoredPrefix() != null) { request.setServletPath("/" + resolvedMount.getMatchingIgnoredPrefix() + resolvedMount.getResolvedMountPath()); } else { request.setServletPath(resolvedMount.getResolvedMountPath()); } }
public HstContainerURL parseURL(ResolvedMount mount, String contextPath, String requestPath, Map<String, String []> queryParams, String requestCharacterEncoding, String requestURIEncoding) { HstContainerURLImpl url = new HstContainerURLImpl(); url.setContextPath(contextPath); url.setHostName(mount.getMount().getVirtualHost().getHostName()); url.setPortNumber(mount.getPortNumber()); url.setResolvedMountPath(mount.getResolvedMountPath()); url.setRequestPath(requestPath); url.setPathInfo(requestPath.substring(mount.getResolvedMountPath().length())); url.setCharacterEncoding(requestCharacterEncoding); url.setURIEncoding(requestURIEncoding); url.setPathInfo(requestPath.substring(mount.getResolvedMountPath().length())); url.setParameters(queryParams); parseRequestInfo(url); return url; }
if (resolvedMount != null) { try { Mount mount = resolvedMount.getMount(); final ResolvedSiteMapItem pathResolvesTo = resolvedMount.matchSiteMapItem(path); final HstSiteMapItem hstSiteMapItem = pathResolvesTo.getHstSiteMapItem(); if (!hstSiteMapItem.isSchemeAgnostic()) { log.debug("Could not match '{}' for mount '{}' : {}", path, resolvedMount.getMount(), e.toString());
requestContext.setCmsRequest(true); if (resolvedMount instanceof MutableResolvedMount) { Mount undecoratedMount = resolvedMount.getMount(); if (!(undecoratedMount instanceof ContextualizableMount)) { String msg = String.format("The matched mount for request '%s' is not an instanceof of a ContextualizableMount. " + log.debug("{} matched to mount '{}'", containerRequest, resolvedMount.getMount()); if (resolvedMount.getMount().isMapped()) { ResolvedSiteMapItem resolvedSiteMapItem = requestContext.getResolvedSiteMapItem(); boolean processSiteMapItemHandlers = false; resolvedSiteMapItem = resolvedMount.matchSiteMapItem(hstContainerUrl.getPathInfo()); if(resolvedSiteMapItem == null) { urlWithExplicitSchemeForRequest = createURLWithExplicitSchemeForRequest(hstSiteMapItem.getScheme(), resolvedSiteMapItem.getResolvedMount().getMount(), req); log.debug("Scheme not allowed: MOVED PERMANENTLY {} to {}", containerRequest, urlWithExplicitSchemeForRequest); res.setHeader("Location", urlWithExplicitSchemeForRequest); urlWithExplicitSchemeForRequest = createURLWithExplicitSchemeForRequest(hstSiteMapItem.getScheme(), resolvedSiteMapItem.getResolvedMount().getMount(), req); log.debug("Scheme not allowed: MOVED TEMPORARILY {} to {}", containerRequest, urlWithExplicitSchemeForRequest); res.sendRedirect(urlWithExplicitSchemeForRequest); log.debug("{} matches mount {} that is not mapped by a sitemap.", containerRequest, resolvedMount.getMount()); if(resolvedMount.getNamedPipeline() == null) { log.warn("'{}' could not be processed by the HST: No hstSite and no custom namedPipeline for Mount", containerRequest); sendError(req, res, HttpServletResponse.SC_NOT_FOUND); finishMatchingPhase(requestContext);
} else if (requestContext.isCmsRequest() || requestContext.getResolvedMount().getMount().isContextPathInUrl()) { urlBuilder.append(containerURL.getContextPath()); if(!StringUtils.isEmpty(requestContext.getResolvedMount().getMatchingIgnoredPrefix())) { urlBuilder.append('/').append(requestContext.getResolvedMount().getMatchingIgnoredPrefix());
mount.getVirtualHost().getVirtualHosts().getCmsPreviewPrefix(), requestContext.getResolvedMount().getPortNumber()); resolvedHostForLink.setResolvedMount(resMount); resolved = mount.getHstSiteMapMatcher().match(resMount.getMount().getHomePage(), resMount); } else { resolved = mount.getHstSiteMapMatcher().match(path, resMount);
if (requestContext.getResolvedMount().getMount().getVirtualHost().getVirtualHosts().isChannelMngrSiteAuthenticationSkipped()) { log.debug("Bypassing security valve because the request comes fo a CMS application and it's configured to skip authentication for those requests."); context.invokeNext(); String formLoginPage = resolvedMount.getFormLoginPage(); Mount destLinkMount = resolvedMount.getMount();
private boolean requestComesFromCms(VirtualHosts vHosts, ResolvedMount resolvedMount) { if(vHosts.getCmsPreviewPrefix() == null || "".equals(vHosts.getCmsPreviewPrefix())) { return true; } if(vHosts.getCmsPreviewPrefix().equals(resolvedMount.getMatchingIgnoredPrefix())) { return true; } return false; }
if (!jcrSession.getNode(resolvedMount.getMount().getContentPath()).getIdentifier() .equals(pageComposerContextService.getRequestConfigIdentifier())) { final String msg = String.format("Representing an expanded parent tree through './%s' is only supported with request " + final HstSiteMapItem siteMapItemByRefId = resolvedMount.getMount().getHstSite().getSiteMap().getSiteMapItemByRefId(siteMapItemRefIdOrPath); if (siteMapItemByRefId != null) { siteMapPathInfo = HstSiteMapUtils.getPath(siteMapItemByRefId); final ResolvedSiteMapItem resolvedSiteMapItem = resolvedMount.matchSiteMapItem(siteMapPathInfo); if (resolvedSiteMapItem.getPathInfo().equals(resolvedMount.getMount().getPageNotFound())) {
String ignoredPrefix = requestContext.getResolvedMount().getMatchingIgnoredPrefix(); if (!StringUtils.isEmpty(ignoredPrefix) && ignoredPrefix.equals(requestContext.getResolvedMount() .getMount().getVirtualHost().getVirtualHosts().getCmsPreviewPrefix())) {
public Mount getMount(HstRequest request){ return getResolvedMount(request).getMount(); }
containerRequest.removeAttribute(ContainerConstants.HST_FORWARD_PATH_INFO); resolvedSiteMapItem = resolvedSiteMapItem.getResolvedMount().matchSiteMapItem(forwardPathInfo); if(resolvedSiteMapItem == null) {
/** * Get the {@link Mount} for the current */ protected Mount getMount(final HstRequest request){ return request.getRequestContext().getResolvedMount().getMount(); }
@Deprecated public ResolvedSiteMapItem matchSiteMapItem(HstContainerURL hstContainerURL) throws MatchException { ResolvedVirtualHost resolvedVirtualHost = matchVirtualHost(hstContainerURL.getHostName()); if(resolvedVirtualHost == null) { throw new MatchException("Unknown host '"+hstContainerURL.getHostName()+"'"); } ResolvedMount resolvedMount = resolvedVirtualHost.matchMount(hstContainerURL.getContextPath(), hstContainerURL.getRequestPath()); if(resolvedMount == null) { throw new MatchException("resolvedVirtualHost '"+hstContainerURL.getHostName()+"' does not have a mount"); } return resolvedMount.matchSiteMapItem(hstContainerURL.getPathInfo()); }
@Override public boolean isPreview() { checkStateValidity(); return this.resolvedMount.getMount().isPreview(); }
@Override public VirtualHost getVirtualHost() { checkStateValidity(); return resolvedMount.getMount().getVirtualHost(); }
public boolean isPreview() { checkStateValidity(); return this.resolvedMount.getMount().isPreview(); }
private static String getCmsLocationByPrefix(final HstRequestContext requestContext, final String prefix) throws ContainerException { final Mount mount = requestContext.getResolvedMount().getMount(); final List<String> cmsLocations = mount.getCmsLocations(); for (String cmsLocation : cmsLocations) { if (cmsLocation.startsWith(prefix)) { return cmsLocation; } } throw new ContainerException("Could not establish a SSO between CMS & site application because no CMS location could be found that starts with '" + prefix + "'"); }