Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2013-07-31 20:41:46 +0000
committerJoakim Erdfelt2013-07-31 20:41:46 +0000
commiteb9fce2fa5f33d45b3ae5fc3747ae59dc372e599 (patch)
tree66c82d4d76abc53d10a90faaf28dd59bbee2086d /jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket
parent0444b87961e77ff39d2f0b209fe379086c23fbb3 (diff)
downloadorg.eclipse.jetty.project-eb9fce2fa5f33d45b3ae5fc3747ae59dc372e599.tar.gz
org.eclipse.jetty.project-eb9fce2fa5f33d45b3ae5fc3747ae59dc372e599.tar.xz
org.eclipse.jetty.project-eb9fce2fa5f33d45b3ae5fc3747ae59dc372e599.zip
JSR-356: fixing Session.getProtocolVersion()
Diffstat (limited to 'jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java36
1 files changed, 23 insertions, 13 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 984c357736..99b532c9ec 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
@@ -76,19 +76,6 @@ public class UpgradeRequest
extensions.add(ExtensionConfig.parse(config));
}
}
-
- /**
- * Get the User Principal for this request.
- * <p>
- * Only applicable when using UpgradeRequest from server side.
- *
- * @return the user principal
- */
- public Principal getUserPrincipal()
- {
- // Server side should override to implement
- return null;
- }
public void clearHeaders()
{
@@ -201,6 +188,16 @@ public class UpgradeRequest
return Collections.unmodifiableMap(parameters);
}
+ public String getProtocolVersion()
+ {
+ String version = getHeader("Sec-WebSocket-Version");
+ if (version == null)
+ {
+ return "13";
+ }
+ return version;
+ }
+
public String getQueryString()
{
return requestURI.getQuery();
@@ -228,6 +225,19 @@ public class UpgradeRequest
return subProtocols;
}
+ /**
+ * Get the User Principal for this request.
+ * <p>
+ * Only applicable when using UpgradeRequest from server side.
+ *
+ * @return the user principal
+ */
+ public Principal getUserPrincipal()
+ {
+ // Server side should override to implement
+ return null;
+ }
+
public boolean hasSubProtocol(String test)
{
for (String protocol : subProtocols)

Back to the top