本文整理了Java中org.kohsuke.stapler.StaplerRequest.getRequestURL()
方法的一些代码示例,展示了StaplerRequest.getRequestURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StaplerRequest.getRequestURL()
方法的具体详情如下:
包路径:org.kohsuke.stapler.StaplerRequest
类名称:StaplerRequest
方法名:getRequestURL
[英]#getRequestURL() plus additional query string part, if it exists.
[中]#getRequestURL()加上额外的查询字符串部分(如果存在)。
代码示例来源:origin: jenkinsci/jenkins
/**
* If the given href link is matching the current page, return true.
*
* Used in {@code task.jelly} to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) return ".".equals(href) && url.endsWith("/");
url = URLDecoder.decode(url,"UTF-8");
href = URLDecoder.decode(href,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);
if (href.endsWith("/")) href = href.substring(0, href.length() - 1);
return url.endsWith(href);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* This method captures the information of a request to terminate a computer instance. Method is public as
* it needs to be called from {@link AbstractCloudSlave} and {@link jenkins.model.Nodes}. In general you should
* not need to call this method directly, however if implementing a custom node type or a different path
* for removing nodes, it may make sense to call this method in order to capture the originating request.
*
* @since 1.607
*/
public void recordTermination() {
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
terminatedBy.add(new TerminationRequest(
String.format("Termination requested at %s by %s [id=%d] from HTTP request for %s",
new Date(),
Thread.currentThread(),
Thread.currentThread().getId(),
request.getRequestURL()
)
));
} else {
terminatedBy.add(new TerminationRequest(
String.format("Termination requested at %s by %s [id=%d]",
new Date(),
Thread.currentThread(),
Thread.currentThread().getId()
)
));
}
}
代码示例来源:origin: jenkinsci/jenkins
StringBuffer reqUrl = req.getRequestURL();
if(reqUrl.charAt(reqUrl.length()-1)!='/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* If the given href link is matching the current page, return true.
*
* Used in <tt>task.jelly</tt> to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) return ".".equals(href) && url.endsWith("/");
url = URLDecoder.decode(url,"UTF-8");
href = URLDecoder.decode(href,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);
if (href.endsWith("/")) href = href.substring(0, href.length() - 1);
return url.endsWith(href);
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* If the given href link is matching the current page, return true.
*
* Used in <tt>task.jelly</tt> to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) return ".".equals(href) && url.endsWith("/");
url = URLDecoder.decode(url,"UTF-8");
href = URLDecoder.decode(href,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);
if (href.endsWith("/")) href = href.substring(0, href.length() - 1);
return url.endsWith(href);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* If the given href link is matching the current page, return true.
*
* Used in <tt>task.jelly</tt> to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) return ".".equals(href) && url.endsWith("/");
url = URLDecoder.decode(url,"UTF-8");
href = URLDecoder.decode(href,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);
if (href.endsWith("/")) href = href.substring(0, href.length() - 1);
return url.endsWith(href);
}
代码示例来源:origin: hudson/hudson-2.x
/**
* If the given href link is matching the current page, return true.
*
* Used in <tt>task.jelly</tt> to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) return ".".equals(href) && url.endsWith("/");
url = URLDecoder.decode(url,"UTF-8");
href = URLDecoder.decode(href,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);
if (href.endsWith("/")) href = href.substring(0, href.length() - 1);
return url.endsWith(href);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* If the given href link is matching the current page, return true.
*
* Used in <tt>task.jelly</tt> to decide if the page should be highlighted.
*/
public boolean hyperlinkMatchesCurrentPage(String href) throws UnsupportedEncodingException {
String url = Stapler.getCurrentRequest().getRequestURL().toString();
if (href == null || href.length() <= 1) {
return ".".equals(href) && url.endsWith("/");
}
url = URLDecoder.decode(url, "UTF-8");
href = URLDecoder.decode(href, "UTF-8");
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
if (href.endsWith("/")) {
href = href.substring(0, href.length() - 1);
}
return url.endsWith(href);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* This method captures the information of a request to terminate a computer instance. Method is public as
* it needs to be called from {@link AbstractCloudSlave} and {@link jenkins.model.Nodes}. In general you should
* not need to call this method directly, however if implementing a custom node type or a different path
* for removing nodes, it may make sense to call this method in order to capture the originating request.
*
* @since 1.607
*/
public void recordTermination() {
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
terminatedBy.add(new TerminationRequest(
String.format("Termination requested at %s by %s [id=%d] from HTTP request for %s",
new Date(),
Thread.currentThread(),
Thread.currentThread().getId(),
request.getRequestURL()
)
));
} else {
terminatedBy.add(new TerminationRequest(
String.format("Termination requested at %s by %s [id=%d]",
new Date(),
Thread.currentThread(),
Thread.currentThread().getId()
)
));
}
}
代码示例来源:origin: org.jenkins-ci.plugins/oic-auth
/**
* When the identity provider is done with its thing, the user comes back here.
*/
public HttpResponse doFinishLogin(StaplerRequest request) throws IOException {
StringBuffer buf = request.getRequestURL();
if (request.getQueryString() != null) {
buf.append('?').append(request.getQueryString());
}
AuthorizationCodeResponseUrl responseUrl = new AuthorizationCodeResponseUrl(buf.toString());
if (! uuid.equals(responseUrl.getState())) {
return HttpResponses.error(401, "State is invalid");
}
String code = responseUrl.getCode();
if (responseUrl.getError() != null) {
return HttpResponses.error(401, "Error from provider: " + code);
} else if (code == null) {
return HttpResponses.error(404, "Missing authorization code");
} else {
return onSuccess(code);
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
StringBuffer reqUrl = req.getRequestURL();
if(reqUrl.charAt(reqUrl.length()-1)!='/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
代码示例来源:origin: hudson/hudson-2.x
StringBuffer reqUrl = req.getRequestURL();
if(reqUrl.charAt(reqUrl.length()-1)!='/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
StringBuffer reqUrl = req.getRequestURL();
if(reqUrl.charAt(reqUrl.length()-1)!='/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
代码示例来源:origin: org.eclipse.hudson/hudson-core
StringBuffer reqUrl = req.getRequestURL();
if (reqUrl.charAt(reqUrl.length() - 1) != '/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
StringBuffer reqUrl = req.getRequestURL();
if(reqUrl.charAt(reqUrl.length()-1)!='/') {
rsp.sendRedirect2(reqUrl.append('/').toString());
内容来源于网络,如有侵权,请联系作者删除!