@Override public VirtualHost getVirtualHost() { return new PreviewDecoratedVirtualHost(delegatee.getVirtualHost()); }
@Override @Deprecated public int getPortNumber() { return delegatee.getPortNumber(); }
@Override @Deprecated public String getResolvedHostName() { return delegatee.getResolvedHostName(); }
log.debug("{} matched to host '{}'", containerRequest, resolvedVirtualHost.getVirtualHost()); resolvedMount = resolvedVirtualHost.matchMount(containerRequest.getContextPath(), containerRequest.getPathInfo()); if (resolvedMount != null) { request.setAttribute(ContainerConstants.RESOLVED_MOUNT_REQUEST_ATTR, resolvedMount);
public HstContainerURL parseURL(HttpServletRequest request, ResolvedSiteMount mount, String requestPath) { HstContainerURLImpl url = new HstContainerURLImpl(); url.setContextPath(request.getContextPath()); url.setHostName(mount.getResolvedVirtualHost().getResolvedHostName()); url.setPortNumber(mount.getResolvedVirtualHost().getPortNumber()); url.setResolvedMountPath(mount.getResolvedMountPath()); url.setRequestPath(requestPath); url.setPathInfo(requestPath.substring(mount.getResolvedMountPath().length())); String characterEncoding = request.getCharacterEncoding(); if (characterEncoding == null) { characterEncoding = "ISO-8859-1"; } url.setCharacterEncoding(characterEncoding); return url; }
public ResolvedSiteMount matchSiteMount(String hostName, String contextPath, String requestPath) throws MatchException { ResolvedVirtualHost resolvedVirtualHost = matchVirtualHost(hostName); ResolvedSiteMount resolvedSiteMount = null; if(resolvedVirtualHost != null) { resolvedSiteMount = resolvedVirtualHost.matchSiteMount(contextPath, requestPath); } return resolvedSiteMount; }
@Override public ResolvedMount matchMount(final String contextPath, final String requestPath) throws MatchException { final ResolvedMount resolvedMount = delegatee.matchMount(contextPath, requestPath); return decoratedResolvedMount(resolvedMount); } }
VirtualHost virtualHost = parentSiteMount.getVirtualHost(); ResolvedVirtualHost resolvedVirtualHost = virtualHost.getVirtualHosts().matchVirtualHost(virtualHost.getName()); ResolvedSiteMount parentResolvedSiteMount = resolvedVirtualHost.matchSiteMount(servletRequest.getContextPath(), parentSiteMount.getMountPath()); ResolvedSiteMapItem parentResolvedSiteMapItem = parentSiteMapMatcher.match("/", parentResolvedSiteMount); if (parentResolvedSiteMapItem == null) {
public ResolvedMount matchMount(String hostName, String contextPath, String requestPath) throws MatchException { Task matchingTask = null; try { if (HDC.isStarted()) { matchingTask = HDC.getCurrentTask().startSubtask("Host and Mount Matching"); } ResolvedVirtualHost resolvedVirtualHost = matchVirtualHost(hostName); ResolvedMount resolvedMount = null; if(resolvedVirtualHost != null) { resolvedMount = resolvedVirtualHost.matchMount(contextPath, requestPath); } return resolvedMount; } finally { if (matchingTask != null) { matchingTask.stop(); } } }
/** * This is a hook into the HstServices component manager to look up in the {@link VirtualHosts} whether the contextPath should be in the * URL. Although this can be overridden per {@link VirtualHost} or {@link Mount}, this is the best we can do at this moment as we do * not have an {@link HstRequestContext} and also no {@link ResolvedMount} thus. * @param request * @return <code>true</code> when the global {@link VirtualHosts} is configured to have the contextPath in the URL */ protected boolean isContextPathInUrl(HttpServletRequest request) { if (loginSiteFromTemplateComposer(request)) { // site running in cms host always needs context path return true; } ResolvedVirtualHost host = (ResolvedVirtualHost) request.getAttribute(ContainerConstants.VIRTUALHOSTS_REQUEST_ATTR); if(host != null) { return host.getVirtualHost().isContextPathInUrl(); } return true; }
public ResolvedSiteMapItem matchSiteMapItem(HstContainerURL hstContainerURL) throws MatchException{ ResolvedVirtualHost resolvedVirtualHost = matchVirtualHost(hstContainerURL.getHostName()); if(resolvedVirtualHost == null) { throw new MatchException("Unknown host '"+hstContainerURL.getHostName()+"'"); } ResolvedSiteMount resolvedSiteMount = resolvedVirtualHost.matchSiteMount(hstContainerURL.getContextPath(), hstContainerURL.getRequestPath()); if(resolvedSiteMount == null) { if(resolvedSiteMount == null) { throw new MatchException("resolvedVirtualHost '"+hstContainerURL.getHostName()+"' does not have a site mount"); } } return resolvedSiteMount.matchSiteMapItem(hstContainerURL.getPathInfo()); }
log.warn("Did not find a matching sitemap item for path '{}', SiteMount '{}' and Host '"+resolvedSiteMount.getResolvedVirtualHost().getResolvedHostName()+"'" + ". Return null", pathInfo, resolvedSiteMount.getSiteMount().getParent() == null ? "hst:root" : resolvedSiteMount.getSiteMount().getMountPath() ); throw new NotFoundException("PathInfo '"+pathInfo+"' could not be matched");
@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()); }
/** * @param resolvedSiteMapItem * @return the HstURLFactory */ public HstURLFactory getURLFactory(ResolvedSiteMapItem resolvedSiteMapItem) { HstURLFactory factory = resolvedSiteMapItem.getResolvedSiteMount().getResolvedVirtualHost().getVirtualHost().getVirtualHosts().getVirtualHostsManager().getUrlFactory(); return factory; } }
ResolvedVirtualHost rvh = requestContext.getResolvedSiteMapItem().getResolvedSiteMount().getResolvedVirtualHost(); String targetContextPath = requestContext.isEmbeddedRequest() ? requestContext.getEmbeddingContextPath() : baseURL.getContextPath(); ResolvedSiteMount mount = rvh.matchSiteMount(targetContextPath, location); if (mount != null && mount.getSiteMount().isSiteMount()) {
siteMapPathInfo = siteMount.getHomePage(); if(siteMapPathInfo == null || "".equals(siteMapPathInfo) || "/".equals(siteMapPathInfo)) { log.warn("SiteMount '{}' for host '{}' does not have a homepage configured and the path info is empty. Cannot map to sitemap item. Return null", getSiteMount().getName(), getResolvedVirtualHost().getResolvedHostName()); throw new MatchException("No homepage configured and empty path after sitemount"); } else {
return; final String hostGroupNameForCmsHost = resolvedVirtualHost.getVirtualHost().getHostGroupName(); requestContext.setAttribute(HOST_GROUP_NAME_FOR_CMS_HOST, hostGroupNameForCmsHost); context.invokeNext();
if (resolvedVirtualHost.getVirtualHost().isContextPathInUrl()) { if (fullyQualifiedPrefix != null) { return fullyQualifiedPrefix + servletRequest.getContextPath() + pathInfo;