Skip to content

Commit 7f89667

Browse files
committed
Upgrade Jetty to 9.4.21
Make use of the new getAvailableExtensionNames() method. Closes gh-23799
1 parent 9689a59 commit 7f89667

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ext {
3333
groovyVersion = "2.5.8"
3434
hsqldbVersion = "2.4.1"
3535
jackson2Version = "2.9.9"
36-
jettyVersion = "9.4.20.v20190813"
36+
jettyVersion = "9.4.21.v20190926"
3737
junit5Version = "5.3.2"
3838
kotlinVersion = "1.2.71"
3939
log4jVersion = "2.11.2"

spring-websocket/src/main/java/org/springframework/web/socket/server/jetty/JettyRequestUpgradeStrategy.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
3232
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
33-
import org.eclipse.jetty.websocket.api.extensions.ExtensionFactory;
3433
import org.eclipse.jetty.websocket.server.HandshakeRFC6455;
3534
import org.eclipse.jetty.websocket.server.WebSocketServerFactory;
3635

@@ -180,14 +179,17 @@ private List<WebSocketExtension> buildWebSocketExtensions() {
180179
return result;
181180
}
182181

183-
@SuppressWarnings({"unchecked"})
182+
@SuppressWarnings({"unchecked", "deprecation"})
184183
private Set<String> getExtensionNames() {
185184
try {
186-
return this.factory.getExtensionFactory().getExtensionNames();
185+
return this.factory.getAvailableExtensionNames();
187186
}
188187
catch (IncompatibleClassChangeError ex) {
188+
// Fallback for versions prior to 9.4.21:
189189
// 9.4.20.v20190813: ExtensionFactory (abstract class -> interface)
190-
Method method = ClassUtils.getMethod(ExtensionFactory.class, "getExtensionNames");
190+
// 9.4.21.v20190926: ExtensionFactory (interface -> abstract class) + deprecated
191+
Class<?> clazz = org.eclipse.jetty.websocket.api.extensions.ExtensionFactory.class;
192+
Method method = ClassUtils.getMethod(clazz, "getExtensionNames");
191193
return (Set<String>) ReflectionUtils.invokeMethod(method, this.factory.getExtensionFactory());
192194
}
193195
}

0 commit comments

Comments
 (0)