public interface UpgradeResponse
| Modifier and Type | Method | Description |
|---|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
Add a header value to the response.
|
java.lang.String |
getAcceptedSubProtocol() |
Get the accepted WebSocket protocol.
|
java.util.List<ExtensionConfig> |
getExtensions() |
Get the list of extensions that should be used for the websocket.
|
java.lang.String |
getHeader(java.lang.String name) |
Get a header value
|
java.util.Set<java.lang.String> |
getHeaderNames() |
Get the header names
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders() |
Get the headers map
|
java.util.List<java.lang.String> |
getHeaders(java.lang.String name) |
Get the multi-value header value
|
int |
getStatusCode() |
Get the HTTP Response Status Code
|
java.lang.String |
getStatusReason() |
Get the HTTP Response Status Reason
|
boolean |
isSuccess() |
Test if upgrade response is successful.
|
void |
sendForbidden(java.lang.String message) |
Issue a forbidden upgrade response.
|
void |
setAcceptedSubProtocol(java.lang.String protocol) |
Set the accepted WebSocket Protocol.
|
void |
setExtensions(java.util.List<ExtensionConfig> extensions) |
Set the list of extensions that are approved for use with this websocket.
|
void |
setHeader(java.lang.String name,
java.lang.String value) |
Set a header
|
void |
setStatusCode(int statusCode) |
Set the HTTP Response status code
|
void |
setStatusReason(java.lang.String statusReason) |
Set the HTTP Response status reason phrase
|
void |
setSuccess(boolean success) |
Set the success of the upgrade response.
|
void addHeader(java.lang.String name,
java.lang.String value)
name - the header namevalue - the header valuejava.lang.String getAcceptedSubProtocol()
java.util.List<ExtensionConfig> getExtensions()
java.lang.String getHeader(java.lang.String name)
name - the header namejava.util.Set<java.lang.String> getHeaderNames()
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
java.util.List<java.lang.String> getHeaders(java.lang.String name)
name - the header nameint getStatusCode()
java.lang.String getStatusReason()
boolean isSuccess()
Merely notes if the response was sent as a WebSocket Upgrade, or was failed (resulting in no upgrade handshake)
void sendForbidden(java.lang.String message)
throws java.io.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 responsejava.io.IOException - if unable to send the forbiddenvoid setAcceptedSubProtocol(java.lang.String protocol)
protocol - the protocol to list as acceptedvoid setExtensions(java.util.List<ExtensionConfig> extensions)
Notes:
UpgradeRequest, just remove
entries you don't want to useextensions - the list of extensions to use.void setHeader(java.lang.String name,
java.lang.String value)
Overrides previous value of header (if set)
name - the header namevalue - the header valuevoid setStatusCode(int statusCode)
statusCode - the status codevoid setStatusReason(java.lang.String statusReason)
Note, not all implementation of UpgradeResponse can support this feature
statusReason - the status reason phrasevoid setSuccess(boolean success)
success - true to indicate a response to the upgrade handshake was sent, false to indicate no upgrade
response was sentCopyright © 1995–2017 Webtide. All rights reserved.