org.kohsuke.stapler.StaplerRequest.getServerPort()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(57)

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

StaplerRequest.getServerPort介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName());
int index = host.indexOf(':');
int port = req.getServerPort();
if (index == -1) {

代码示例来源:origin: org.kohsuke.stapler/stapler

public String getFullUrl() {
  StringBuilder buf = new StringBuilder();
  StaplerRequest req = Stapler.getCurrentRequest();
  buf.append(req.getScheme());
  buf.append("://");
  buf.append(req.getServerName());
  if(req.getServerPort()!=80)
    buf.append(':').append(req.getServerPort());
  buf.append(getUrl());
  return buf.toString();
}

代码示例来源:origin: org.hudsonci.stapler/stapler-core

public String getFullUrl() {
  StringBuilder buf = new StringBuilder();
  StaplerRequest req = Stapler.getCurrentRequest();
  buf.append(req.getScheme());
  buf.append("://");
  buf.append(req.getServerName());
  if(req.getServerPort()!=80)
    buf.append(':').append(req.getServerPort());
  buf.append(getUrl());
  return buf.toString();
}

代码示例来源:origin: stapler/stapler

public String getFullUrl() {
  StringBuilder buf = new StringBuilder();
  StaplerRequest req = Stapler.getCurrentRequest();
  buf.append(req.getScheme());
  buf.append("://");
  buf.append(req.getServerName());
  if(req.getServerPort()!=80)
    buf.append(':').append(req.getServerPort());
  buf.append(getUrl());
  return buf.toString();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/".
 *
 * <p>
 * Unlike {@link #getRootUrl()}, which uses the manually configured value,
 * this one uses the current request to reconstruct the URL. The benefit is
 * that this is immune to the configuration mistake (users often fail to set the root URL
 * correctly, especially when a migration is involved), but the downside
 * is that unless you are processing a request, this method doesn't work.
 *
 * @since 1.263
 */
public String getRootUrlFromRequest() {
  StaplerRequest req = Stapler.getCurrentRequest();
  StringBuilder buf = new StringBuilder();
  buf.append(req.getScheme() + "://");
  buf.append(req.getServerName());
  if (req.getServerPort() != 80) {
    buf.append(':').append(req.getServerPort());
  }
  buf.append(req.getContextPath()).append('/');
  return buf.toString();
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/".
 *
 * <p>
 * Unlike {@link #getRootUrl()}, which uses the manually configured value,
 * this one uses the current request to reconstruct the URL. The benefit is
 * that this is immune to the configuration mistake (users often fail to set the root URL
 * correctly, especially when a migration is involved), but the downside
 * is that unless you are processing a request, this method doesn't work.
 *
 * @since 1.263
 */
public String getRootUrlFromRequest() {
  StaplerRequest req = Stapler.getCurrentRequest();
  StringBuilder buf = new StringBuilder();
  buf.append(req.getScheme() + "://");
  buf.append(req.getServerName());
  if (req.getServerPort() != 80) {
    buf.append(':').append(req.getServerPort());
  }
  buf.append(req.getContextPath()).append('/');
  return buf.toString();
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the absolute URL of Hudson top page, such as "http://localhost/hudson/".
 *
 * <p>
 * Unlike {@link #getRootUrl()}, which uses the manually configured value,
 * this one uses the current request to reconstruct the URL. The benefit is
 * that this is immune to the configuration mistake (users often fail to set the root URL
 * correctly, especially when a migration is involved), but the downside
 * is that unless you are processing a request, this method doesn't work.
 *
 * @since 1.263
 */
public String getRootUrlFromRequest() {
  StaplerRequest req = Stapler.getCurrentRequest();
  StringBuilder buf = new StringBuilder();
  buf.append(req.getScheme() + "://");
  buf.append(req.getServerName());
  if (req.getServerPort() != 80) {
    buf.append(':').append(req.getServerPort());
  }
  buf.append(req.getContextPath()).append('/');
  return buf.toString();
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the absolute URL of Hudson top page, such as
 * "http://localhost/hudson/".
 *
 * <p>
 * Unlike {@link #getRootUrl()}, which uses the manually configured value,
 * this one uses the current request to reconstruct the URL. The benefit is
 * that this is immune to the configuration mistake (users often fail to set
 * the root URL correctly, especially when a migration is involved), but the
 * downside is that unless you are processing a request, this method doesn't
 * work.
 *
 * @since 1.263
 */
public String getRootUrlFromRequest() {
  StaplerRequest req = Stapler.getCurrentRequest();
  StringBuilder buf = new StringBuilder();
  buf.append(req.getScheme() + "://");
  buf.append(req.getServerName());
  if (req.getServerPort() != 80) {
    buf.append(':').append(req.getServerPort());
  }
  buf.append(req.getContextPath()).append('/');
  return buf.toString();
}

代码示例来源:origin: org.kohsuke.stapler/stapler

if ((req.getScheme().equals("http") && req.getServerPort()!=80)
|| (req.getScheme().equals("https") && req.getServerPort()!=443))
  buf.append(':').append(req.getServerPort());
url = buf.append(url).toString();

代码示例来源:origin: stapler/stapler

if ((req.getScheme().equals("http") && req.getServerPort()!=80)
|| (req.getScheme().equals("https") && req.getServerPort()!=443))
  buf.append(':').append(req.getServerPort());
url = buf.append(url).toString();

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName());
int index = host.indexOf(':');
int port = req.getServerPort();
if (index == -1) {

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法