37
37
import org .glassfish .tyrus .servlet .TyrusHttpUpgradeHandler ;
38
38
import org .glassfish .tyrus .websockets .Connection ;
39
39
import org .glassfish .tyrus .websockets .Version ;
40
+ import org .glassfish .tyrus .websockets .WebSocketApplication ;
40
41
import org .glassfish .tyrus .websockets .WebSocketEngine ;
41
42
import org .glassfish .tyrus .websockets .WebSocketEngine .WebSocketHolderListener ;
42
43
import org .springframework .http .HttpHeaders ;
@@ -80,28 +81,28 @@ public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse respon
80
81
HttpServletResponse servletResponse = ((ServletServerHttpResponse ) response ).getServletResponse ();
81
82
servletResponse = new AlreadyUpgradedResponseWrapper (servletResponse );
82
83
83
- TyrusEndpoint tyrusEndpoint = createTyrusEndpoint (servletRequest , endpoint , selectedProtocol );
84
+ WebSocketApplication wsApp = createTyrusEndpoint (servletRequest , endpoint , selectedProtocol );
84
85
WebSocketEngine engine = WebSocketEngine .getEngine ();
85
86
86
87
try {
87
- engine .register (tyrusEndpoint );
88
+ engine .register (wsApp );
88
89
}
89
90
catch (DeploymentException ex ) {
90
91
throw new HandshakeFailureException ("Failed to deploy endpoint in GlassFish" , ex );
91
92
}
92
93
93
94
try {
94
- if (!performUpgrade (servletRequest , servletResponse , request .getHeaders (), tyrusEndpoint )) {
95
+ if (!performUpgrade (servletRequest , servletResponse , request .getHeaders (), wsApp )) {
95
96
throw new HandshakeFailureException ("Failed to upgrade HttpServletRequest" );
96
97
}
97
98
}
98
99
finally {
99
- engine .unregister (tyrusEndpoint );
100
+ engine .unregister (wsApp );
100
101
}
101
102
}
102
103
103
104
private boolean performUpgrade (HttpServletRequest request , HttpServletResponse response ,
104
- HttpHeaders headers , TyrusEndpoint tyrusEndpoint ) throws IOException {
105
+ HttpHeaders headers , WebSocketApplication wsApp ) throws IOException {
105
106
106
107
final TyrusHttpUpgradeHandler upgradeHandler ;
107
108
try {
@@ -114,7 +115,7 @@ private boolean performUpgrade(HttpServletRequest request, HttpServletResponse r
114
115
Connection connection = createConnection (upgradeHandler , response );
115
116
116
117
RequestContext wsRequest = RequestContext .Builder .create ()
117
- .requestURI (URI .create (tyrusEndpoint .getPath ())).requestPath (tyrusEndpoint .getPath ())
118
+ .requestURI (URI .create (wsApp .getPath ())).requestPath (wsApp .getPath ())
118
119
.connection (connection ).secure (request .isSecure ()).build ();
119
120
120
121
for (String header : headers .keySet ()) {
@@ -129,7 +130,8 @@ public void onWebSocketHolder(WebSocketEngine.WebSocketHolder webSocketHolder) {
129
130
});
130
131
}
131
132
132
- private TyrusEndpoint createTyrusEndpoint (HttpServletRequest request , Endpoint endpoint , String selectedProtocol ) {
133
+ private WebSocketApplication createTyrusEndpoint (HttpServletRequest request ,
134
+ Endpoint endpoint , String selectedProtocol ) {
133
135
134
136
// Use randomized path
135
137
String requestUri = request .getRequestURI ();
0 commit comments