org.hippoecm.hst.configuration.hosting.VirtualHost类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.hippoecm.hst.configuration.hosting.VirtualHost类的一些代码示例,展示了VirtualHost类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VirtualHost类的具体详情如下:
包路径:org.hippoecm.hst.configuration.hosting.VirtualHost
类名称:VirtualHost

VirtualHost介绍

[英]VirtualHost which holds the mapping between host (server name) and site name.
[中]VirtualHost,它保存主机(服务器名称)和站点名称之间的映射。

代码示例

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public VirtualHosts getVirtualHosts() {
  return new PreviewDecoratedVirtualHosts(delegatee.getVirtualHosts());
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public String getHostName() {
  return delegatee.getHostName();
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public boolean isContextPathInUrl() {
  return delegatee.isContextPathInUrl();
}

代码示例来源:origin: org.onehippo.cms7.hst.client-modules/hst-page-composer

@Override
public Optional<Channel> getChannelByMountId(final String mountId) {
  if (StringUtils.isBlank(mountId)) {
    throw new IllegalArgumentException("MountId argument must not be blank");
  }
  final VirtualHost virtualHost = getCurrentVirtualHost();
  final List<Mount> mounts = virtualHost.getVirtualHosts().getMountsByHostGroup(virtualHost.getHostGroupName());
  return mounts.stream()
      .filter(mount -> StringUtils.equals(mount.getIdentifier(), mountId))
      .map(Mount::getChannel)
      .filter(Objects::nonNull)
      .findFirst();
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

PortMount tryPortMount = tryHost.getPortMount(portNumber);
if(tryPortMount != null && tryPortMount.getRootMount() != null) {
  tryPortMount = tryHost.getPortMount(0);
  if(tryPortMount != null && tryPortMount.getRootMount() != null) {
      log.debug("We already did find a possible matching host ('{}') with not an explicit portnumber match but we'll use host ('{}') as this one is equally suited.", host.getHostName() + " (hostgroup="+host.getHostGroupName()+")", tryHost.getHostName() + " (hostgroup="+tryHost.getHostGroupName()+")");

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

this.contextPathInUrl = parent.isContextPathInUrl();
  } else {
    this.contextPathInUrl = virtualHost.isContextPathInUrl();
    this.showPort = parent.isPortInUrl();
  } else {
    this.showPort = virtualHost.isPortInUrl();
    this.contextPath = virtualHost.getContextPath();
  } else {
    this.contextPath = parent.getContextPath();
  scheme = parent != null ? parent.getScheme() : virtualHost.getScheme();
  schemeAgnostic = mount.getValueProvider().getBoolean(HstNodeTypes.GENERAL_PROEPRTY_SCHEME_AGNOSTIC);
} else {
  schemeAgnostic = parent != null ? parent.isSchemeAgnostic() : virtualHost.isSchemeAgnostic();
      parent.getSchemeNotMatchingResponseCode() : virtualHost.getSchemeNotMatchingResponseCode();
    this.homepage = parent.getHomePage();
  } else {
    this.homepage = virtualHost.getHomePage();
    this.locale = parent.getLocale();
  } else {
    this.locale = virtualHost.getLocale();
    this.pageNotFound = parent.getPageNotFound();

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

public ResolvedMount matchMount(String contextPath, String requestPath) throws MatchException {
    log.error("Virtual Host '{}' for portnumber '{}' is not (correctly) mounted: We cannot return a ResolvedMount. Return null", virtualHost.getHostName(), String.valueOf(portMount.getPortNumber())); 
    return null;
  if(!StringUtils.isEmpty(virtualHost.getVirtualHosts().getCmsPreviewPrefix())) {
    if (path.equals(virtualHost.getVirtualHosts().getCmsPreviewPrefix())) {
      matchingIgnoredPrefix = virtualHost.getVirtualHosts().getCmsPreviewPrefix();
      path = "";
    } else if (path.startsWith(virtualHost.getVirtualHosts().getCmsPreviewPrefix() + "/")){
      matchingIgnoredPrefix = virtualHost.getVirtualHosts().getCmsPreviewPrefix();
      path = path.substring(virtualHost.getVirtualHosts().getCmsPreviewPrefix().length() +1);
    log.warn("Virtual Host '{}' is not (correctly) mounted for portnumber '{}' and contextpath '{}': " +
        "We cannot return a ResolvedMount. Return null",
        virtualHost.getHostName(), String.valueOf(portMount.getPortNumber()), contextPath);
    return null;

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

ch.setCmsPreviewPrefix(virtualHost.getVirtualHosts().getCmsPreviewPrefix());
ch.setHostname(virtualHost.getHostName());
url.append(virtualHost.getHostName());
if (mount.isPortInUrl()) {
  int port = mount.getPort();
if (virtualHost.isContextPathInUrl() && mount.getContextPath() != null) {
  url.append(mount.getContextPath());

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public String getHostGroupName() {
  return delegatee.getHostGroupName();
}

代码示例来源:origin: org.onehippo.cms7.hst/hst-client

if (!farthestRequestScheme.equals(hstSiteMapItem.getScheme())) {
        fullyQualifiedPrefix = hstSiteMapItem.getScheme() + "://" + mount.getVirtualHost().getHostName();
        if (mount.isPortInUrl()) {
          int port = mount.getPort();
if (resolvedVirtualHost.getVirtualHost().isContextPathInUrl()) {
  if (fullyQualifiedPrefix != null) {
    return fullyQualifiedPrefix + servletRequest.getContextPath() + pathInfo;

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

String hostGroup = mount.getVirtualHost().getHostGroupName();
    log.error("Incorrect hst:hosts configuration. Not allowed to have multiple mount's having the same " +
        "'alias/type/types' combination within a single hst:hostgroup. Failed for mount '{}' in " +
        "hostgroup '" + mount.getVirtualHost().getHostGroupName()+"' for host '" +
        mount.getVirtualHost().getHostName() + "'. Make sure that you add a unique 'alias' in " +
        "combination with the 'types' on the mount within a single hostgroup. The mount '{}' cannot " +
        "be used for lookup. Change alias for it. Conflicting mounts are " + mount + " that " +

代码示例来源:origin: org.onehippo.ecm.hst.testsuite.sandbox/hst-jaxrs

HstSiteMapMatcher parentSiteMapMatcher = parentSiteMount.getHstSiteMapMatcher();
VirtualHost virtualHost = parentSiteMount.getVirtualHost();
ResolvedVirtualHost resolvedVirtualHost = virtualHost.getVirtualHosts().matchVirtualHost(virtualHost.getName());
ResolvedSiteMount parentResolvedSiteMount = resolvedVirtualHost.matchSiteMount(servletRequest.getContextPath(), parentSiteMount.getMountPath());
ResolvedSiteMapItem parentResolvedSiteMapItem = parentSiteMapMatcher.match("/", parentResolvedSiteMount);

代码示例来源:origin: org.onehippo.ecm.hst.components/hst-core

this.contextPathInUrl = parent.isContextPathInUrl();
} else {
  this.contextPathInUrl = virtualHost.isContextPathInUrl();
  this.scheme = parent.getScheme();
} else {
  this.scheme = virtualHost.getScheme();
  this.homepage = parent.getHomePage();
} else {
  this.homepage = virtualHost.getHomePage();

代码示例来源:origin: org.onehippo.ecm.hst.components/hst-core

public ResolvedSiteMount matchSiteMount(String contextPath, String requestPath) throws MatchException {
  PortMount portMount = virtualHost.getPortMount(portNumber);
  if(portMount == null && portNumber != 0) {
    log.debug("Could not match the request to port '{}'. If there is a default port '0', we'll try this one");
    portMount = virtualHost.getPortMount(0);
    if(portMount == null) {
      log.warn("Virtual Host '{}' is not (correctly) mounted for portnumber '{}': We cannot return a ResolvedSiteMount. Return null", virtualHost.getHostName(), String.valueOf(portNumber));
      return null;
    log.warn("Virtual Host '{}' for portnumber '{}' is not (correctly) mounted: We cannot return a ResolvedSiteMount. Return null", virtualHost.getHostName(), String.valueOf(portNumber)); 
    return null;
    log.warn("Virtual Host '{}' is not (correctly) mounted for portnumber '{}': We cannot return a ResolvedSiteMount. Return null", virtualHost.getHostName(), String.valueOf(portMount.getPortNumber()));
    return null;

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

if (!isHostSame(requestContext.getRenderHost(), mount.getVirtualHost().getHostName())) {
  renderHost = mount.getVirtualHost().getHostName();
if (StringUtils.isNotBlank(mount.getVirtualHost().getCdnHost())) {
  final HstSiteMapItem siteMapItem = resolveSiteMapItem(requestContext);
  if (siteMapItem != null && siteMapItem.isContainerResource()
      && isCdnSupportedPipeline(siteMapItem.getNamedPipeline())) {
    log.debug("Using CDN host '{}' for container resource '{}'", mount.getVirtualHost().getCdnHost(), urlString);
    return mount.getVirtualHost().getCdnHost() + urlString;
  String host = scheme + "://" + mount.getVirtualHost().getHostName();
  if (mount.isPortInUrl()) {
    int port = mount.getPort();

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public String getBaseURL(final HttpServletRequest request) {
  return delegatee.getBaseURL(request);
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

/**
 * Override this method if you want a different algorithm to resolve requestServerName
 * @param matchedHost
 * @param hostNameSegments
 * @param depth
 * @return
 */
protected VirtualHost traverseInToHost(VirtualHost matchedHost, String[] hostNameSegments, int depth) {
  if(depth == 0) {
    return matchedHost;
  }
  --depth;
  VirtualHost vhost = matchedHost.getChildHost(hostNameSegments[depth]);
  if(vhost == null) {
    if( (vhost = matchedHost.getChildHost(WILDCARD)) != null) {
      return vhost;
    }
  } else {
    return traverseInToHost(vhost, hostNameSegments, depth);
  }
  return null;
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public String getHomePage() {
  return delegatee.getHomePage();
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public String getName() {
  return delegatee.getName();
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

@Override
public PortMount getPortMount(final int portNumber) {
  PortMount portMount = delegatee.getPortMount(portNumber);
  if (portMount == null) {
    return null;
  }
  return new PreviewDecoratedPortMount(portMount);
}

相关文章