16
16
17
17
package org .springframework .web .socket .server .standard ;
18
18
19
+ import java .util .Arrays ;
20
+ import java .util .Collections ;
21
+ import java .util .List ;
22
+ import javax .servlet .http .HttpServletRequest ;
23
+ import javax .servlet .http .HttpServletResponse ;
24
+ import javax .websocket .Decoder ;
25
+ import javax .websocket .Encoder ;
26
+ import javax .websocket .Endpoint ;
27
+ import javax .websocket .Extension ;
28
+
19
29
import io .undertow .server .HttpServerExchange ;
20
30
import io .undertow .server .HttpUpgradeListener ;
21
31
import io .undertow .servlet .api .InstanceFactory ;
31
41
import io .undertow .websockets .jsr .EndpointSessionHandler ;
32
42
import io .undertow .websockets .jsr .ServerWebSocketContainer ;
33
43
import io .undertow .websockets .jsr .handshake .HandshakeUtil ;
44
+ import org .xnio .StreamConnection ;
45
+
34
46
import org .springframework .http .server .ServerHttpRequest ;
35
47
import org .springframework .http .server .ServerHttpResponse ;
36
48
import org .springframework .web .socket .server .HandshakeFailureException ;
37
- import org .xnio .StreamConnection ;
38
-
39
- import javax .servlet .http .HttpServletRequest ;
40
- import javax .servlet .http .HttpServletResponse ;
41
- import javax .websocket .Decoder ;
42
- import javax .websocket .Encoder ;
43
- import javax .websocket .Endpoint ;
44
- import javax .websocket .Extension ;
45
- import java .util .*;
46
49
47
50
48
51
/**
@@ -60,13 +63,13 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat
60
63
61
64
62
65
public UndertowRequestUpgradeStrategy () {
63
- this .handshakes = new Handshake [] { new Hybi13Handshake (), new Hybi08Handshake (), new Hybi07Handshake () };
66
+ this .handshakes = new Handshake [] {new Hybi13Handshake (), new Hybi08Handshake (), new Hybi07Handshake ()};
64
67
this .supportedVersions = initSupportedVersions (this .handshakes );
65
68
}
66
69
67
70
private String [] initSupportedVersions (Handshake [] handshakes ) {
68
71
String [] versions = new String [handshakes .length ];
69
- for (int i = 0 ; i < versions .length ; i ++) {
72
+ for (int i = 0 ; i < versions .length ; i ++) {
70
73
versions [i ] = handshakes [i ].getVersion ().toHttpHeaderValue ();
71
74
}
72
75
return versions ;
@@ -125,8 +128,7 @@ private ConfiguredServerEndpoint createConfiguredServerEndpoint(String selectedP
125
128
endpointRegistration .setSubprotocols (Arrays .asList (selectedProtocol ));
126
129
endpointRegistration .setExtensions (selectedExtensions );
127
130
128
- return new ConfiguredServerEndpoint (endpointRegistration ,
129
- new EndpointInstanceFactory (endpoint ), null ,
131
+ return new ConfiguredServerEndpoint (endpointRegistration , new EndpointInstanceFactory (endpoint ), null ,
130
132
new EncodingFactory (
131
133
Collections .<Class <?>, List <InstanceFactory <? extends Encoder >>>emptyMap (),
132
134
Collections .<Class <?>, List <InstanceFactory <? extends Decoder >>>emptyMap (),
@@ -145,7 +147,6 @@ public EndpointInstanceFactory(Endpoint endpoint) {
145
147
146
148
@ Override
147
149
public InstanceHandle <Endpoint > createInstance () throws InstantiationException {
148
-
149
150
return new InstanceHandle <Endpoint >() {
150
151
@ Override
151
152
public Endpoint getInstance () {
0 commit comments