public class UpgradeResponse extends Object implements javax.net.websocket.HandshakeResponse
Modifier and Type | Field and Description |
---|---|
static String |
SEC_WEBSOCKET_PROTOCOL |
Constructor and Description |
---|
UpgradeResponse() |
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.
|
String |
getHeader(String name) |
Set<String> |
getHeaderNames() |
Map<String,List<String>> |
getHeaders() |
List<String> |
getHeaders(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 |
setSuccess(boolean success) |
public static final String SEC_WEBSOCKET_PROTOCOL
public String getAcceptedSubProtocol()
public List<ExtensionConfig> getExtensions()
public Map<String,List<String>> getHeaders()
getHeaders
in interface javax.net.websocket.HandshakeResponse
public int getStatusCode()
public String getStatusReason()
public boolean isSuccess()
public void sendForbidden(String message) throws IOException
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.
message
- the short 1 line detail message about the forbidden responseIOException
public void setAcceptedSubProtocol(String protocol)
protocol
- the protocol to list as acceptedpublic void setExtensions(List<ExtensionConfig> extensions)
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 useextensions
- the list of extensions to use.public void setStatusCode(int statusCode)
public void setStatusReason(String statusReason)
public void setSuccess(boolean success)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.