Issue #5492 - Changing from "java.feature.*" to "runtime.feature.*"
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
de5b8bc84a
commit
1b15c1e4a3
|
@ -5,7 +5,7 @@ Enables the ALPN (Application Layer Protocol Negotiation) TLS extension.
|
|||
|
||||
[depend]
|
||||
ssl
|
||||
alpn-impl/alpn-available-${java.feature.alpn}
|
||||
alpn-impl/alpn-available-${runtime.feature.alpn}
|
||||
|
||||
[lib]
|
||||
lib/jetty-alpn-client-${jetty.version}.jar
|
||||
|
|
|
@ -1507,9 +1507,10 @@ public class StartArgs
|
|||
properties.setProperty("java.version.platform", Integer.toString(ver.getPlatform()), source);
|
||||
|
||||
// features built into java.
|
||||
properties.setProperty("java.feature.alpn", Boolean.toString(ver.getPlatform() >= 9), source);
|
||||
properties.setProperty("java.feature.jpms", Boolean.toString(ver.getPlatform() >= 9), source);
|
||||
properties.setProperty("java.feature.loom", Boolean.toString(ver.getPlatform() >= 16), source);
|
||||
// TODO: Remove in Jetty 10+
|
||||
properties.setProperty("runtime.feature.alpn", Boolean.toString(isMethodAvailable(javax.net.ssl.SSLParameters.class, "getApplicationProtocols", null)), source);
|
||||
// TODO: Remove in Jetty 10+
|
||||
properties.setProperty("runtime.feature.jpms", Boolean.toString(isClassAvailable("java.lang.ModuleLayer")), source);
|
||||
|
||||
// @deprecated - below will be removed in Jetty 10.x
|
||||
properties.setProperty("java.version.major", Integer.toString(ver.getMajor()), "Deprecated");
|
||||
|
@ -1531,6 +1532,32 @@ public class StartArgs
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isMethodAvailable(Class<?> clazz, String methodName, Class<?>[] params)
|
||||
{
|
||||
try
|
||||
{
|
||||
clazz.getMethod(methodName, params);
|
||||
return true;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isClassAvailable(String clazzname)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName(clazzname, false, this.getClass().getClassLoader());
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRun(boolean run)
|
||||
{
|
||||
this.run = run;
|
||||
|
|
Loading…
Reference in New Issue