Class UpgradeResponseAdapter
java.lang.Object
org.eclipse.jetty.websocket.common.UpgradeResponseAdapter
- All Implemented Interfaces:
UpgradeResponse
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGet the accepted WebSocket protocol.Get the list of extensions that should be used for the websocket.getHeaders(String name) intbooleanvoidsendForbidden(String message) Issue a forbidden upgrade response.voidsetAcceptedSubProtocol(String protocol) Set the accepted WebSocket Protocol.voidsetExtensions(List<ExtensionConfig> extensions) Set the list of extensions that are approved for use with this websocket.voidvoidsetStatusCode(int statusCode) voidsetStatusReason(String statusReason) voidsetSuccess(boolean success)
-
Field Details
-
SEC_WEBSOCKET_PROTOCOL
- See Also:
-
-
Constructor Details
-
UpgradeResponseAdapter
public UpgradeResponseAdapter()
-
-
Method Details
-
addHeader
- Specified by:
addHeaderin interfaceUpgradeResponse
-
getAcceptedSubProtocol
Get the accepted WebSocket protocol.- Specified by:
getAcceptedSubProtocolin interfaceUpgradeResponse- Returns:
- the accepted WebSocket protocol.
-
getExtensions
Get the list of extensions that should be used for the websocket.- Specified by:
getExtensionsin interfaceUpgradeResponse- Returns:
- the list of negotiated extensions to use.
-
getHeader
- Specified by:
getHeaderin interfaceUpgradeResponse
-
getHeaderNames
- Specified by:
getHeaderNamesin interfaceUpgradeResponse
-
getHeaders
- Specified by:
getHeadersin interfaceUpgradeResponse
-
getHeaders
- Specified by:
getHeadersin interfaceUpgradeResponse
-
getStatusCode
public int getStatusCode()- Specified by:
getStatusCodein interfaceUpgradeResponse
-
getStatusReason
- Specified by:
getStatusReasonin interfaceUpgradeResponse
-
isSuccess
public boolean isSuccess()- Specified by:
isSuccessin interfaceUpgradeResponse
-
sendForbidden
Issue a forbidden upgrade response.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.
- Specified by:
sendForbiddenin interfaceUpgradeResponse- Parameters:
message- the short 1 line detail message about the forbidden response- Throws:
IOException- if unable to send the forbidden
-
setAcceptedSubProtocol
Set the accepted WebSocket Protocol.- Specified by:
setAcceptedSubProtocolin interfaceUpgradeResponse- Parameters:
protocol- the protocol to list as accepted
-
setExtensions
Set the list of extensions that are approved for use with this websocket.Notes:
- Per the spec you cannot add extensions that have not been seen in the
UpgradeRequest, just remove entries you don't want to use - If this is unused, or a null is passed, then the list negotiation will follow default behavior and use the complete list of extensions that are available in this WebSocket server implementation.
- Specified by:
setExtensionsin interfaceUpgradeResponse- Parameters:
extensions- the list of extensions to use.
- Per the spec you cannot add extensions that have not been seen in the
-
setHeader
- Specified by:
setHeaderin interfaceUpgradeResponse
-
setStatusCode
public void setStatusCode(int statusCode) - Specified by:
setStatusCodein interfaceUpgradeResponse
-
setStatusReason
- Specified by:
setStatusReasonin interfaceUpgradeResponse
-
setSuccess
public void setSuccess(boolean success) - Specified by:
setSuccessin interfaceUpgradeResponse
-