提交 7f896677 编写于 作者: R Rossen Stoyanchev

Upgrade Jetty to 9.4.21

Make use of the new getAvailableExtensionNames() method.

Closes gh-23799
上级 9689a59a
...@@ -33,7 +33,7 @@ ext { ...@@ -33,7 +33,7 @@ ext {
groovyVersion = "2.5.8" groovyVersion = "2.5.8"
hsqldbVersion = "2.4.1" hsqldbVersion = "2.4.1"
jackson2Version = "2.9.9" jackson2Version = "2.9.9"
jettyVersion = "9.4.20.v20190813" jettyVersion = "9.4.21.v20190926"
junit5Version = "5.3.2" junit5Version = "5.3.2"
kotlinVersion = "1.2.71" kotlinVersion = "1.2.71"
log4jVersion = "2.11.2" log4jVersion = "2.11.2"
......
...@@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse; ...@@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; 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.HandshakeRFC6455;
import org.eclipse.jetty.websocket.server.WebSocketServerFactory; import org.eclipse.jetty.websocket.server.WebSocketServerFactory;
...@@ -180,14 +179,17 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Serv ...@@ -180,14 +179,17 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Serv
return result; return result;
} }
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked", "deprecation"})
private Set<String> getExtensionNames() { private Set<String> getExtensionNames() {
try { try {
return this.factory.getExtensionFactory().getExtensionNames(); return this.factory.getAvailableExtensionNames();
} }
catch (IncompatibleClassChangeError ex) { catch (IncompatibleClassChangeError ex) {
// Fallback for versions prior to 9.4.21:
// 9.4.20.v20190813: ExtensionFactory (abstract class -> interface) // 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()); return (Set<String>) ReflectionUtils.invokeMethod(method, this.factory.getExtensionFactory());
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册