提交 aef64182 编写于 作者: K kohsuke

[FIXED HUDSON-1767] no absolute URLs in HTML rendering. Fixed in1.221.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9755 71c3de6d-444a-0410-be80-ed276b4c234a
上级 b6ff565b
......@@ -125,6 +125,12 @@ public interface Item extends PersistenceRoot, SearchableModelObject {
* absolute URL.
* @throws IllegalStateException
* if the method is invoked outside the HTTP request processing.
*
* @deprecated
* This method shall <b>NEVER</b> be used during HTML page rendering, as it won't work with
* network set up like Apache reverse proxy.
* This method is only intended for the remote API clients who cannot resolve relative references
* (even this won't work for the same reason, which should be fixed.)
*/
String getAbsoluteUrl();
......
......@@ -455,6 +455,15 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
return project.getUrl()+getNumber()+'/';
}
/**
* Obtains the absolute URL to this build.
*
* @deprecated
* This method shall <b>NEVER</b> be used during HTML page rendering, as it won't work with
* network set up like Apache reverse proxy.
* This method is only intended for the remote API clients who cannot resolve relative references
* (even this won't work for the same reason, which should be fixed.)
*/
@Exported(visibility=2,name="url")
public final String getAbsoluteUrl() {
return project.getAbsoluteUrl()+getNumber()+'/';
......
......@@ -38,7 +38,7 @@
<li class="${elementClass}" style="${elementStyle}">
<!-- child test results are referenced from their parent builds -->
<j:set var="build" value="${testObject.owner}" />
<a href="${build.absoluteUrl}${build.testResultAction.urlName}/${testObject.getRelativePathFrom(null)}">
<a href="${it.urlName}/${testObject.getRelativePathFrom(null)}">
${testObject.fullName}
</a>
</li>
......
......@@ -17,7 +17,7 @@
<j:forEach var="report" items="${it.childReports}">
<tr>
<td class="pane">
<a href="${report.child.absoluteUrl}">${report.child.project.name}</a>
<a href="../${report.child.project.shortUrl}">${report.child.project.name}</a>
</td>
<td class="pane" style="text-align:right;">
${report.result.durationString}
......@@ -49,7 +49,7 @@
<h3>
<a name="${report.child.project.name}"/>
<a href="${report.child.absoluteUrl}">${report.child.project.name}</a>
<a href="../${report.child.project.shortUrl}">${report.child.project.name}</a>
</h3>
<table class="pane sortable">
......@@ -61,7 +61,7 @@
<j:forEach var="f" items="${report.result.failedTests}" varStatus="i">
<tr>
<td class="pane">
<a href="${report.child.absoluteUrl}/testReport/${f.getRelativePathFrom(report.result)}">
<a href="../${report.child.project.shortUrl}/testReport/${f.getRelativePathFrom(report.result)}">
<st:out value="${f.fullName}"/>
</a>
</td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册