Fixes - NullPointerException in WebSocketTransport.
Worked around cases where WebSocket implementations do not
return an absolute URI from HandshakeRequest.getRequestURI().
@@ -106,8 +106,8 @@ public class WebSocketTransport extends AbstractWebSocketTransport {
// Hopefully these will become a standard, for now they are Jetty specific.
(InetSocketAddress)userProperties.get("javax.websocket.endpoint.localAddress"),
(InetSocketAddress)userProperties.get("javax.websocket.endpoint.remoteAddress"),
- retrieveLocales(userProperties), "HTTP/1.1",
- request.getRequestURI().getScheme().equalsIgnoreCase("https"));
+ WebSocketTransport.retrieveLocales(userProperties), "HTTP/1.1",
+ WebSocketTransport.isSecure(request));
}
}
@@ -120,6 +120,11 @@ public class WebSocketTransport extends AbstractWebSocketTransport {
return locales;
}
+ private static boolean isSecure(HandshakeRequest request) {
+ String scheme = request.getRequestURI().getScheme();
+ return "https".equalsIgnoreCase(scheme) || "wss".equalsIgnoreCase(scheme);
+ }
+
private class Configurator extends ServerEndpointConfig.Configurator {
private final ServletContext servletContext;
