JSR-356: fixing Session.getProtocolVersion()
This commit is contained in:
parent
0444b87961
commit
eb9fce2fa5
|
@ -77,19 +77,6 @@ public class UpgradeRequest
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
headers.clear();
|
||||
|
@ -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)
|
||||
|
|
|
@ -429,6 +429,7 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
|
|||
public void setUpgradeRequest(UpgradeRequest request)
|
||||
{
|
||||
this.upgradeRequest = request;
|
||||
this.protocolVersion = request.getProtocolVersion();
|
||||
}
|
||||
|
||||
public void setUpgradeResponse(UpgradeResponse response)
|
||||
|
|
Loading…
Reference in New Issue