mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-05 08:05:56 +00:00
Avoid code duplication
This commit is contained in:
1 parent
962c1c1dab
commit
7bf67b6d0e
3 files changed
+23
-18
No files matched your search
@@ -1765,4 +1765,24 @@ public class Functions {
|
||||
.replaceAll("(\\w{10})(?=\\w{3})", "$1<wbr>")
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Advertises the minimum set of HTTP headers that assist programmatic
|
||||
* discovery of Jenkins.
|
||||
*/
|
||||
public static void advertiseHeaders(HttpServletResponse rsp) {
|
||||
Jenkins j = Jenkins.getInstance();
|
||||
|
||||
rsp.setHeader("X-Hudson","1.395");
|
||||
rsp.setHeader("X-Jenkins", Jenkins.VERSION);
|
||||
rsp.setHeader("X-Jenkins-Session", Jenkins.SESSION_HASH);
|
||||
|
||||
TcpSlaveAgentListener tal = j.tcpSlaveAgentListener;
|
||||
if (tal !=null) {
|
||||
rsp.setIntHeader("X-Hudson-CLI-Port", tal.getPort());
|
||||
rsp.setIntHeader("X-Jenkins-CLI-Port", tal.getPort());
|
||||
rsp.setIntHeader("X-Jenkins-CLI2-Port", tal.getPort());
|
||||
rsp.setHeader("X-Jenkins-CLI-Host", TcpSlaveAgentListener.CLI_HOST_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user