Upgrade Jetty to 9.4.21

Make use of the new getAvailableExtensionNames() method.

Closes gh-23565
This commit is contained in:
Rossen Stoyanchev 2019-10-23 16:00:56 +01:00
parent 88ec452dee
commit b343e733df
2 changed files with 7 additions and 5 deletions

View File

@ -47,7 +47,7 @@ configure(allprojects) { project ->
mavenBom "io.netty:netty-bom:4.1.39.Final"
mavenBom "io.projectreactor:reactor-bom:Dysprosium-RELEASE"
mavenBom "io.rsocket:rsocket-bom:1.0.0-RC5"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.20.v20190813"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.21.v20190926"
mavenBom "org.jetbrains.kotlin:kotlin-bom:1.3.50"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.2"
mavenBom "org.junit:junit-bom:5.5.2"

View File

@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.api.extensions.ExtensionFactory;
import org.eclipse.jetty.websocket.server.HandshakeRFC6455;
import org.eclipse.jetty.websocket.server.WebSocketServerFactory;
@ -180,14 +179,17 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Serv
return result;
}
@SuppressWarnings({"unchecked"})
@SuppressWarnings({"unchecked", "deprecation"})
private Set<String> getExtensionNames() {
try {
return this.factory.getExtensionFactory().getExtensionNames();
return this.factory.getAvailableExtensionNames();
}
catch (IncompatibleClassChangeError ex) {
// Fallback for versions prior to 9.4.21:
// 9.4.20.v20190813: ExtensionFactory (abstract class -> interface)
Method method = ClassUtils.getMethod(ExtensionFactory.class, "getExtensionNames");
// 9.4.21.v20190926: ExtensionFactory (interface -> abstract class) + deprecated
Class<?> clazz = org.eclipse.jetty.websocket.api.extensions.ExtensionFactory.class;
Method method = ClassUtils.getMethod(clazz, "getExtensionNames");
return (Set<String>) ReflectionUtils.invokeMethod(method, this.factory.getExtensionFactory());
}
}