org.hippoecm.hst.configuration.hosting.VirtualHost.getBaseURL()方法的使用及代码示例

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

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

VirtualHost.getBaseURL介绍

[英]Returns the base of the URL as seen by for example a browser. The base URL is consists of scheme + hostname + portnumber for example 'http://www.hippoecm.org:8081' The scheme is 'http' by default, unless #getScheme() returns something else The hostname is the HttpServeltRequest request.getServerName() (proxies must have ProxyPreserveHost On) The portnumber is as follows:

  • when #isPortVisible() is false, there is no portnumber

  • otherwise:

  • port = #getPortNumber()

    • if (port == 0) {port = request.getServerPort()}
    • if(port == 80 && "http".equals(scheme)) || (port == 443 && "https".equals(scheme)): no portnumber will be in baseUrl
      [中]返回URL的基数,如浏览器所示。基本URL由scheme + hostname + portnumber组成,例如'http://www.hippoecm.org:8081'除非#getScheme()返回其他内容,否则默认情况下,该方案为'http'。主机名为HttpServeltRequest请求。getServerName()(代理必须有ProxyPreserveHost On)端口号如下:
      *当#isPortVisible()为[$3$]时,没有端口号
      *否则:
  • port = #getPortNumber()

  • if (port == 0) {port = request.getServerPort()}
    *如果(端口==80&&“http.equals(scheme))| |(端口==443&&“https.equals(scheme)):baseUrl中不会有端口号

代码示例

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

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

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

public String toUrlForm(HstRequest request, HstResponse response, boolean external) {
  String characterEncoding = response.getCharacterEncoding();
  
  if (characterEncoding == null) {
    characterEncoding = "UTF-8";
  }
  if(path == null) {
    log.warn("Unable to rewrite link. Return EVAL_PAGE");
    return null;
  }
  
  String urlString = null;
  
  if (this.containerResource) {
    HstURL hstUrl = response.createResourceURL(ContainerConstants.CONTAINER_REFERENCE_NAMESPACE);
    hstUrl.setResourceID(path);
    urlString = hstUrl.toString();
  } else {
    urlString = response.createNavigationalURL(path).toString();
  }
  
  if(external) {
    VirtualHost vhost =  request.getRequestContext().getResolvedSiteMapItem().getResolvedSiteMount().getSiteMount().getVirtualHost();
    urlString = vhost.getBaseURL(request) + urlString;
  }
  
  return urlString;
}

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

String absoluteRedirectUrl = requestContext.getVirtualHost().getBaseURL(servletRequest) + redirectLocation;
  servletResponse.sendRedirect(absoluteRedirectUrl);
} else {

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

String fullyQualifiedURL = requestContext.getVirtualHost().getBaseURL(servletRequest) + redirectLocation;
  sendRedirect(servletResponse, fullyQualifiedURL, permanent);
} else {

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

String absoluteRedirectUrl = requestContext.getVirtualHost().getBaseURL(servletRequest) + location;
  servletResponse.sendRedirect(absoluteRedirectUrl);
} else {

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

String absoluteRedirectUrl = requestContext.getVirtualHost().getBaseURL(servletRequest) + location;
  servletResponse.sendRedirect(absoluteRedirectUrl);
} else {

相关文章