提交 217b2934 编写于 作者: M Mark Waite 提交者: Oleg Nenashev

[JENKINS-52282] Add isJavaWebStartSupported to JNLPLauncher (#3766)

* [JENKINS-52282] Add isJavaWebStartSupported to JNLPLauncher

Seems cleaner to use JNLPLauncher than to use Functions.  Narrows the
scope of the method so that callers know it is specific to
JNLPLauncher.

* Include hyperlink to jenkins.io Java Web Start redirect page
上级 b0d1501c
......@@ -221,4 +221,19 @@ public class JNLPLauncher extends ComputerLauncher {
}
}
/**
* Returns true if Java Web Start button should be displayed.
* Java Web Start is only supported when the Jenkins server is
* running with Java 8. Earlier Java versions are not supported by Jenkins.
* Later Java versions do not support Java Web Start.
*
* This flag is checked in {@code config.jelly} before displaying the
* Java Web Start button.
* @return {@code true} if Java Web Start button should be displayed.
* @since FIXME
*/
@Restricted(NoExternalUse.class) // Jelly use
public boolean isJavaWebStartSupported() {
return System.getProperty("java.version", "1.8").startsWith("1.8");
}
}
......@@ -37,14 +37,27 @@ THE SOFTWARE.
${%Connect agent to Jenkins one of these ways:}
</p>
<ul>
<li>
<p>
<a href="slave-agent.jnlp" id="jnlp-link">
<img src="${imagesURL}/webstart.gif" alt="${%launch agent}" />
</a>
${%Launch agent from browser}
</p>
</li>
<j:choose>
<j:when test="${it.launcher.javaWebStartSupported}">
<li>
<p>
<a href="slave-agent.jnlp" id="jnlp-link">
<img src="${imagesURL}/webstart.gif" alt="${%launch agent}" />
</a>
${%Launch agent from browser}
</p>
</li>
</j:when>
<j:otherwise>
<li>
<p>
<a href="https://jenkins.io/redirect/java11-java-web-start">
${%Java Web Start is not available for the JVM version running Jenkins}
</a>
</p>
</li>
</j:otherwise>
</j:choose>
<j:choose>
<j:when test="${it.ACL.hasPermission(app.ANONYMOUS, it.CONNECT)}">
<li>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册