418792 - Session getProtocolVersion always returns null

+ Backporting just the getProtocolVersion from jetty 9.1
This commit is contained in:
Joakim Erdfelt 2013-10-07 16:45:21 -07:00
parent 7cb553557e
commit 180d9a55df
3 changed files with 12 additions and 3 deletions

View File

@ -181,6 +181,16 @@ public class UpgradeRequest
{ {
return Collections.unmodifiableMap(parameters); return Collections.unmodifiableMap(parameters);
} }
public String getProtocolVersion()
{
String version = getHeader("Sec-WebSocket-Version");
if (version == null)
{
return "13"; // Default
}
return version;
}
public String getQueryString() public String getQueryString()
{ {

View File

@ -163,7 +163,7 @@ public class UpgradeResponse
/** /**
* Set the list of extensions that are approved for use with this websocket. * Set the list of extensions that are approved for use with this websocket.
* <p> * <p>
* 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.
* <p> * <p>
* Notes: * Notes:
* <ul> * <ul>

View File

@ -361,8 +361,6 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
/** /**
* Open/Activate the session * Open/Activate the session
*
* @throws IOException
*/ */
public void open() public void open()
{ {
@ -423,6 +421,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
public void setUpgradeRequest(UpgradeRequest request) public void setUpgradeRequest(UpgradeRequest request)
{ {
this.upgradeRequest = request; this.upgradeRequest = request;
this.protocolVersion = request.getProtocolVersion();
} }
public void setUpgradeResponse(UpgradeResponse response) public void setUpgradeResponse(UpgradeResponse response)