本文整理了Java中org.kohsuke.stapler.StaplerRequest.getServerPort()
方法的一些代码示例,展示了StaplerRequest.getServerPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StaplerRequest.getServerPort()
方法的具体详情如下:
包路径:org.kohsuke.stapler.StaplerRequest
类名称: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) {
内容来源于网络,如有侵权,请联系作者删除!