Class DelegatedServerUpgradeResponse
java.lang.Object
org.eclipse.jetty.ee10.websocket.server.internal.DelegatedServerUpgradeResponse
- All Implemented Interfaces:
JettyServerUpgradeResponse
,UpgradeResponse
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a header value to the response.Get the accepted WebSocket protocol.Get the list of extensions that should be used for the websocket.Get a header valueGet the header namesGet the headers mapgetHeaders
(String name) Get the multi-value header valueint
Get the HTTP Response Status Codeboolean
Returns a boolean indicating if the response has been committed.void
Sends an error response to the client using the specified status.void
sendForbidden
(String message) Issue a forbidden upgrade response.void
setAcceptedSubProtocol
(String protocol) Set the accepted WebSocket Protocol.void
setExtensions
(List<ExtensionConfig> configs) Set the list of extensions that are approved for use with this websocket.void
Set a headervoid
Set a headervoid
setStatusCode
(int statusCode) Set the HTTP Response status code
-
Constructor Details
-
DelegatedServerUpgradeResponse
-
-
Method Details
-
addHeader
Description copied from interface:JettyServerUpgradeResponse
Add a header value to the response.- Specified by:
addHeader
in interfaceJettyServerUpgradeResponse
- Parameters:
name
- the header namevalue
- the header value
-
setHeader
Description copied from interface:JettyServerUpgradeResponse
Set a headerOverrides previous value of header (if set)
- Specified by:
setHeader
in interfaceJettyServerUpgradeResponse
- Parameters:
name
- the header namevalue
- the header value
-
setHeader
Description copied from interface:JettyServerUpgradeResponse
Set a headerOverrides previous value of header (if set)
- Specified by:
setHeader
in interfaceJettyServerUpgradeResponse
- Parameters:
name
- the header namevalues
- the header values
-
getAcceptedSubProtocol
Description copied from interface:UpgradeResponse
Get the accepted WebSocket protocol.- Specified by:
getAcceptedSubProtocol
in interfaceUpgradeResponse
- Returns:
- the accepted WebSocket protocol.
-
getExtensions
Description copied from interface:UpgradeResponse
Get the list of extensions that should be used for the websocket.- Specified by:
getExtensions
in interfaceUpgradeResponse
- Returns:
- the list of negotiated extensions to use.
-
getHeader
Description copied from interface:UpgradeResponse
Get a header value- Specified by:
getHeader
in interfaceUpgradeResponse
- Parameters:
name
- the header name- Returns:
- the value (null if header doesn't exist)
-
getHeaderNames
Description copied from interface:UpgradeResponse
Get the header names- Specified by:
getHeaderNames
in interfaceUpgradeResponse
- Returns:
- the set of header names
-
getHeaders
Description copied from interface:UpgradeResponse
Get the headers map- Specified by:
getHeaders
in interfaceUpgradeResponse
- Returns:
- the map of headers
-
getHeaders
Description copied from interface:UpgradeResponse
Get the multi-value header value- Specified by:
getHeaders
in interfaceUpgradeResponse
- Parameters:
name
- the header name- Returns:
- the list of values (null if header doesn't exist)
-
getStatusCode
public int getStatusCode()Description copied from interface:UpgradeResponse
Get the HTTP Response Status Code- Specified by:
getStatusCode
in interfaceUpgradeResponse
- Returns:
- the status code
-
sendForbidden
Description copied from interface:JettyServerUpgradeResponse
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:
sendForbidden
in interfaceJettyServerUpgradeResponse
- Parameters:
message
- the short 1 line detail message about the forbidden response- Throws:
IOException
- if unable to send the forbidden
-
setAcceptedSubProtocol
Description copied from interface:JettyServerUpgradeResponse
Set the accepted WebSocket Protocol.- Specified by:
setAcceptedSubProtocol
in interfaceJettyServerUpgradeResponse
- Parameters:
protocol
- the protocol to list as accepted
-
setExtensions
Description copied from interface:JettyServerUpgradeResponse
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:
setExtensions
in interfaceJettyServerUpgradeResponse
- Parameters:
configs
- the list of extensions to use.
- Per the spec you cannot add extensions that have not been seen in the
-
setStatusCode
public void setStatusCode(int statusCode) Description copied from interface:JettyServerUpgradeResponse
Set the HTTP Response status code- Specified by:
setStatusCode
in interfaceJettyServerUpgradeResponse
- Parameters:
statusCode
- the status code
-
isCommitted
public boolean isCommitted()Description copied from interface:JettyServerUpgradeResponse
Returns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.- Specified by:
isCommitted
in interfaceJettyServerUpgradeResponse
- Returns:
- a boolean indicating if the response has been committed.
-
sendError
Description copied from interface:JettyServerUpgradeResponse
Sends an error response to the client using the specified status.- Specified by:
sendError
in interfaceJettyServerUpgradeResponse
- Parameters:
statusCode
- the error status codemessage
- the descriptive message- Throws:
IOException
- If an input or output exception occurs
-