Skip to content

Commit

Permalink
[JENKINS-52282] Add isJavaWebStartSupported to JNLPLauncher
Browse files Browse the repository at this point in the history
Seems cleaner to use JNLPLauncher than to use Functions.  Narrows the
scope of the method so that callers know it is specific to
JNLPLauncher.
  • Loading branch information
MarkEWaite committed Nov 23, 2018
1 parent b6b7656 commit cae208a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
15 changes: 15 additions & 0 deletions core/src/main/java/hudson/slaves/JNLPLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,19 @@ public boolean filterType(@Nonnull Class<?> contextClass, @Nonnull Descriptor de
}
}

/**
* 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");
}
}
18 changes: 10 additions & 8 deletions core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ 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:if 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:if>
<j:choose>
<j:when test="${it.ACL.hasPermission(app.ANONYMOUS, it.CONNECT)}">
<li>
Expand Down

0 comments on commit cae208a

Please sign in to comment.