Merge pull request #5494 from eclipse/jetty-9.4.x-5492-java-features-start-properties

Issue #5492 - Adding java.features.* start properties
This commit is contained in:
Joakim Erdfelt 2021-02-18 16:04:39 -06:00 committed by GitHub
commit bbcae23774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 24 additions and 34 deletions

View File

@ -1,7 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Selects an ALPN (Application Layer Protocol Negotiation) implementation by java version.
[depend]
alpn-impl/alpn-${java.version.platform}

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-9

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-9

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-11

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-11

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-11

View File

@ -1,4 +0,0 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[depend]
alpn-impl/alpn-11

View File

@ -5,7 +5,7 @@ Enables the ALPN (Application Layer Protocol Negotiation) TLS extension.
[depend]
ssl
alpn-impl
alpn-impl/alpn-available-${runtime.feature.alpn}
[lib]
lib/jetty-alpn-client-${jetty.version}.jar

View File

@ -1505,10 +1505,14 @@ public class StartArgs
{
JavaVersion ver = JavaVersion.parse(value);
properties.setProperty("java.version.platform", Integer.toString(ver.getPlatform()), source);
// @deprecated - below will be removed in Jetty 10.x
properties.setProperty("java.version.major", Integer.toString(ver.getMajor()), "Deprecated");
properties.setProperty("java.version.minor", Integer.toString(ver.getMinor()), "Deprecated");
properties.setProperty("java.version.micro", Integer.toString(ver.getMicro()), "Deprecated");
// ALPN feature exists
properties.setProperty("runtime.feature.alpn", Boolean.toString(isMethodAvailable(javax.net.ssl.SSLParameters.class, "getApplicationProtocols", null)), source);
}
catch (Throwable x)
{
@ -1525,6 +1529,19 @@ public class StartArgs
}
}
private boolean isMethodAvailable(Class<?> clazz, String methodName, Class<?>[] params)
{
try
{
clazz.getMethod(methodName, params);
return true;
}
catch (NoSuchMethodException e)
{
return false;
}
}
public void setRun(boolean run)
{
this.run = run;

View File

@ -143,6 +143,7 @@ public class ConfigurationAssert
"jetty.base.uri".equals(name) ||
"user.dir".equals(name) ||
prop.source.equals(Props.ORIGIN_SYSPROP) ||
name.startsWith("runtime.feature.") ||
name.startsWith("java."))
{
// strip these out from assertion, to make assertions easier.

View File

@ -225,8 +225,11 @@ public class MainTest
{
Path distPath = MavenTestingUtils.getTestResourceDir("dist-home").toPath().toRealPath();
Path homePath = MavenTestingUtils.getTargetTestingPath().resolve("dist home with spaces");
IO.copy(distPath.toFile(), homePath.toFile());
Files.createFile(homePath.resolve("lib/a library.jar"));
if (!Files.exists(homePath))
{
IO.copy(distPath.toFile(), homePath.toFile());
Files.createFile(homePath.resolve("lib/a library.jar"));
}
List<String> cmdLineArgs = new ArrayList<>();
cmdLineArgs.add("user.dir=" + homePath);