Skip to content

Commit b7e75c5

Browse files
committed
Fix websocket compatibility with Tyrus 1.9 - 1.12
As of Tyrus 1.9, `TyrusEndpointWrapper`'s constructor has a new Boolean argument (which is mandatory). This commit reflectively chooses the right constructor method for Tyrus 1.9+ versions. Issue: SPR-13566
1 parent 59637ee commit b7e75c5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,14 @@ public Object createdEndpoint(ServerEndpointRegistration registration, Component
216216
Object sessionListener = accessor.getPropertyValue("sessionListener");
217217
Object clusterContext = accessor.getPropertyValue("clusterContext");
218218
try {
219-
return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
220-
"/", registration.getConfigurator(), sessionListener, clusterContext, null);
219+
if (constructor.getParameterCount() == 9) {
220+
return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
221+
"/", registration.getConfigurator(), sessionListener, clusterContext, null);
222+
}
223+
else {
224+
return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
225+
"/", registration.getConfigurator(), sessionListener, clusterContext, null, Boolean.TRUE);
226+
}
221227
}
222228
catch (Exception ex) {
223229
throw new HandshakeFailureException("Failed to register " + registration, ex);

0 commit comments

Comments
 (0)