本文整理了Java中org.kohsuke.stapler.StaplerRequest.getScheme()
方法的一些代码示例,展示了StaplerRequest.getScheme()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StaplerRequest.getScheme()
方法的具体详情如下:
包路径:org.kohsuke.stapler.StaplerRequest
类名称:StaplerRequest
方法名:getScheme
暂无
代码示例来源: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: jenkinsci/jenkins
String scheme = getXForwardedHeader(req, "X-Forwarded-Proto", req.getScheme());
buf.append(scheme).append("://");
String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName());
代码示例来源: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.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.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.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: 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.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();
}
代码示例来源: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.kohsuke.stapler/stapler
StringBuilder buf = new StringBuilder(req.getScheme()).append("://").append(req.getServerName());
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.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.jenkins-ci.main/jenkins-core
String scheme = getXForwardedHeader(req, "X-Forwarded-Proto", req.getScheme());
buf.append(scheme).append("://");
String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName());
代码示例来源:origin: stapler/stapler
StringBuilder buf = new StringBuilder(req.getScheme()).append("://").append(req.getServerName());
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();
内容来源于网络,如有侵权,请联系作者删除!