public class ClientUpgradeResponse extends Object implements UpgradeResponse
Modifier and Type | Field and Description |
---|---|
static String |
SEC_WEBSOCKET_PROTOCOL |
Constructor and Description |
---|
ClientUpgradeResponse() |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
String value) |
String |
getAcceptedSubProtocol()
Get the accepted WebSocket protocol.
|
List<ExtensionConfig> |
getExtensions()
Get the list of extensions that should be used for the websocket.
|
Set<String> |
getHeaderNamesSet() |
String |
getHeaderValue(String name) |
Iterator<String> |
getHeaderValues(String name) |
int |
getStatusCode() |
String |
getStatusReason() |
boolean |
isSuccess() |
void |
sendForbidden(String message)
Issue a forbidden upgrade response.
|
void |
setAcceptedSubProtocol(String protocol)
Set the accepted WebSocket Protocol.
|
void |
setExtensions(List<ExtensionConfig> extensions)
Set the list of extensions that are approved for use with this websocket.
|
void |
setHeader(String name,
String value) |
void |
setStatusCode(int statusCode) |
void |
setStatusReason(String statusReason) |
void |
validateWebSocketHash(String expectedHash) |
public static final String SEC_WEBSOCKET_PROTOCOL
public void addHeader(String name, String value)
addHeader
in interface UpgradeResponse
public String getAcceptedSubProtocol()
UpgradeResponse
getAcceptedSubProtocol
in interface UpgradeResponse
public List<ExtensionConfig> getExtensions()
UpgradeResponse
getExtensions
in interface UpgradeResponse
public Set<String> getHeaderNamesSet()
getHeaderNamesSet
in interface UpgradeResponse
public String getHeaderValue(String name)
getHeaderValue
in interface UpgradeResponse
public Iterator<String> getHeaderValues(String name)
getHeaderValues
in interface UpgradeResponse
public int getStatusCode()
getStatusCode
in interface UpgradeResponse
public String getStatusReason()
getStatusReason
in interface UpgradeResponse
public boolean isSuccess()
isSuccess
in interface UpgradeResponse
public void sendForbidden(String message) throws IOException
UpgradeResponse
This means that the websocket endpoint was valid, but the conditions to use a WebSocket resulted in a forbidden access.
Use this when the origin or authentication is invalid.
sendForbidden
in interface UpgradeResponse
message
- the short 1 line detail message about the forbidden responseIOException
public void setAcceptedSubProtocol(String protocol)
UpgradeResponse
setAcceptedSubProtocol
in interface UpgradeResponse
protocol
- the protocol to list as acceptedpublic void setExtensions(List<ExtensionConfig> extensions)
UpgradeResponse
This is Advanced usage of the WebSocketCreator
to allow for a custom set of negotiated extensions.
Notes:
UpgradeRequest
, just remove entries you don't want to usesetExtensions
in interface UpgradeResponse
extensions
- the list of extensions to use.public void setHeader(String name, String value)
setHeader
in interface UpgradeResponse
public void setStatusCode(int statusCode)
public void setStatusReason(String statusReason)
public void validateWebSocketHash(String expectedHash) throws UpgradeException
validateWebSocketHash
in interface UpgradeResponse
UpgradeException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.