6060import org .springframework .util .ReflectionUtils ;
6161import org .springframework .web .socket .server .HandshakeFailureException ;
6262
63-
6463/**
65- * RequestUpgradeStrategy for WildFly and its underlying Undertow web
66- * server. Also compatible with embedded Undertow usage.
64+ * A WebSocket {@code RequestUpgradeStrategy} for WildFly and its underlying
65+ * Undertow web server. Also compatible with embedded Undertow usage.
6766 *
68- * <p>Compatible with Undertow 1.0 to 1.3 and also 1.3.5+ - as included in
69- * WildFly 8.x, 9 and 10.
67+ * <p>Designed for Undertow 1.3.5+ as of Spring Framework 4.3, with a fallback
68+ * strategy for Undertow 1.0 to 1.3 - as included in WildFly 8.x, 9 and 10.
7069 *
7170 * @author Rossen Stoyanchev
7271 * @since 4.0.1
7372 */
7473public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrategy {
7574
76- private static final boolean HAS_DO_UPGRADE = ClassUtils .hasMethod (ServerWebSocketContainer .class ,
77- "doUpgrade" , ( Class <?>[]) null );
75+ private static final boolean HAS_DO_UPGRADE = ClassUtils .hasMethod (ServerWebSocketContainer .class , "doUpgrade" ,
76+ HttpServletRequest . class , HttpServletResponse . class , ServerEndpointConfig . class , Map . class );
7877
7978 private static final FallbackStrategy FALLBACK_STRATEGY = (HAS_DO_UPGRADE ? null : new FallbackStrategy ());
8079
@@ -108,8 +107,7 @@ protected void upgradeInternal(ServerHttpRequest request, ServerHttpResponse res
108107 endpointConfig .setExtensions (selectedExtensions );
109108
110109 try {
111- getContainer (servletRequest ).doUpgrade (servletRequest , servletResponse ,
112- endpointConfig , pathParams );
110+ getContainer (servletRequest ).doUpgrade (servletRequest , servletResponse , endpointConfig , pathParams );
113111 }
114112 catch (ServletException ex ) {
115113 throw new HandshakeFailureException (
@@ -121,8 +119,7 @@ protected void upgradeInternal(ServerHttpRequest request, ServerHttpResponse res
121119 }
122120 }
123121 else {
124- FALLBACK_STRATEGY .upgradeInternal (request , response , selectedProtocol ,
125- selectedExtensions , endpoint );
122+ FALLBACK_STRATEGY .upgradeInternal (request , response , selectedProtocol , selectedExtensions , endpoint );
126123 }
127124 }
128125
@@ -195,10 +192,8 @@ private static class FallbackStrategy extends AbstractStandardUpgradeStrategy {
195192 }
196193 }
197194
198-
199195 private final Set <WebSocketChannel > peerConnections ;
200196
201-
202197 public FallbackStrategy () {
203198 if (exchangeConstructorWithPeerConnections ) {
204199 this .peerConnections = Collections .newSetFromMap (new ConcurrentHashMap <WebSocketChannel , Boolean >());
@@ -208,7 +203,6 @@ public FallbackStrategy() {
208203 }
209204 }
210205
211-
212206 @ Override
213207 public String [] getSupportedVersions () {
214208 return VERSIONS ;
0 commit comments