From 180d9a55df6d7b023769224f13f304244e6e2687 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 7 Oct 2013 16:45:21 -0700 Subject: [PATCH] 418792 - Session getProtocolVersion always returns null + Backporting just the getProtocolVersion from jetty 9.1 --- .../eclipse/jetty/websocket/api/UpgradeRequest.java | 10 ++++++++++ .../eclipse/jetty/websocket/api/UpgradeResponse.java | 2 +- .../jetty/websocket/common/WebSocketSession.java | 3 +-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java index e805f8614b8..28405122f88 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java @@ -181,6 +181,16 @@ public class UpgradeRequest { return Collections.unmodifiableMap(parameters); } + + public String getProtocolVersion() + { + String version = getHeader("Sec-WebSocket-Version"); + if (version == null) + { + return "13"; // Default + } + return version; + } public String getQueryString() { diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java index 51a04c00495..cf4424af0fe 100644 --- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java +++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeResponse.java @@ -163,7 +163,7 @@ public class UpgradeResponse /** * Set the list of extensions that are approved for use with this websocket. *

- * This is Advanced usage of the {@link WebSocketCreator} to allow for a custom set of negotiated extensions. + * This is Advanced usage of the WebSocketCreator to allow for a custom set of negotiated extensions. *

* Notes: *