本文整理了Java中org.kohsuke.stapler.StaplerRequest.getLocalPort()
方法的一些代码示例,展示了StaplerRequest.getLocalPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StaplerRequest.getLocalPort()
方法的具体详情如下:
包路径:org.kohsuke.stapler.StaplerRequest
类名称:StaplerRequest
方法名:getLocalPort
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Jenkins.getInstance().getRootUrl();
if(rootUrl !=null)
// prefer the one explicitly configured, to work with load-balancer, frontend, etc.
return rootUrl;
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if(! (req.getScheme().equals("http") && req.getLocalPort()==80 || req.getScheme().equals("https") && req.getLocalPort()==443))
buf.append(':').append(req.getLocalPort());
buf.append(req.getContextPath()).append('/');
return buf.toString();
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Hudson.getInstance().getRootUrl();
if(rootUrl !=null)
// prefer the one explicitly configured, to work with load-balancer, frontend, etc.
return rootUrl;
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if(req.getLocalPort()!=80)
buf.append(':').append(req.getLocalPort());
buf.append(req.getContextPath()).append('/');
return buf.toString();
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Hudson.getInstance().getRootUrl();
if(rootUrl !=null)
// prefer the one explicitly configured, to work with load-balancer, frontend, etc.
return rootUrl;
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if(req.getLocalPort()!=80)
buf.append(':').append(req.getLocalPort());
buf.append(req.getContextPath()).append('/');
return buf.toString();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Jenkins.getInstance().getRootUrl();
if(rootUrl !=null)
// prefer the one explicitly configured, to work with load-balancer, frontend, etc.
return rootUrl;
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if(! (req.getScheme().equals("http") && req.getLocalPort()==80 || req.getScheme().equals("https") && req.getLocalPort()==443))
buf.append(':').append(req.getLocalPort());
buf.append(req.getContextPath()).append('/');
return buf.toString();
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Hudson.getInstance().getRootUrl();
if (rootUrl != null) // prefer the one explicitly configured, to work with load-balancer, frontend, etc.
{
return rootUrl;
}
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if (req.getLocalPort() != 80) {
buf.append(':').append(req.getLocalPort());
}
buf.append(getRequestRootPath(req)).append('/');
return buf.toString();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Infers the hudson installation URL from the given request.
*/
public static String inferHudsonURL(StaplerRequest req) {
String rootUrl = Hudson.getInstance().getRootUrl();
if(rootUrl !=null)
// prefer the one explicitly configured, to work with load-balancer, frontend, etc.
return rootUrl;
StringBuilder buf = new StringBuilder();
buf.append(req.getScheme()).append("://");
buf.append(req.getServerName());
if(req.getLocalPort()!=80)
buf.append(':').append(req.getLocalPort());
buf.append(req.getContextPath()).append('/');
return buf.toString();
}
内容来源于网络,如有侵权,请联系作者删除!