Skip to content

Commit acb6d25

Browse files
committed
[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.
1 parent 389c5a7 commit acb6d25

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

core/src/main/java/hudson/slaves/JNLPLauncher.java

+14
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,18 @@ public boolean filterType(@Nonnull Class<?> contextClass, @Nonnull Descriptor de
221221
}
222222
}
223223

224+
/**
225+
* Returns true if Java Web Start button should be displayed.
226+
* Java Web Start is only supported when the Jenkins server is
227+
* running with Java 8. Earlier Java versions are not supported by Jenkins.
228+
* Later Java versions do not support Java Web Start.
229+
*
230+
* This flag is checked in {@code config.jelly} before displaying the
231+
* Java Web Start button.
232+
* @return {@code true} if Java Web Start button should be displayed.
233+
* @since FIXME
234+
*/
235+
public boolean isJavaWebStartSupported() {
236+
return System.getProperty("java.version", "1.8").startsWith("1.8");
237+
}
224238
}

core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly

+10-8
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ THE SOFTWARE.
3737
${%Connect agent to Jenkins one of these ways:}
3838
</p>
3939
<ul>
40-
<li>
41-
<p>
42-
<a href="slave-agent.jnlp" id="jnlp-link">
43-
<img src="${imagesURL}/webstart.gif" alt="${%launch agent}" />
44-
</a>
45-
${%Launch agent from browser}
46-
</p>
47-
</li>
40+
<j:if test="${it.launcher.javaWebStartSupported}">
41+
<li>
42+
<p>
43+
<a href="slave-agent.jnlp" id="jnlp-link">
44+
<img src="${imagesURL}/webstart.gif" alt="${%launch agent}" />
45+
</a>
46+
${%Launch agent from browser}
47+
</p>
48+
</li>
49+
</j:if>
4850
<j:choose>
4951
<j:when test="${it.ACL.hasPermission(app.ANONYMOUS, it.CONNECT)}">
5052
<li>

0 commit comments

Comments
 (0)