Class DelegatedServerUpgradeResponse
java.lang.Object
org.eclipse.jetty.websocket.server.internal.DelegatedServerUpgradeResponse
- All Implemented Interfaces:
UpgradeResponse,JettyServerUpgradeResponse
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd 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 valueintGet the HTTP Response Status CodebooleanReturns a boolean indicating if the response has been committed.voidSends an error response to the client using the specified status.voidsendForbidden(String message) Issue a forbidden upgrade response.voidsetAcceptedSubProtocol(String protocol) Set the accepted WebSocket Protocol.voidsetExtensions(List<ExtensionConfig> configs) Set the list of extensions that are approved for use with this websocket.voidSet a headervoidSet a headervoidsetStatusCode(int statusCode) Set the HTTP Response status code
-
Constructor Details
-
DelegatedServerUpgradeResponse
-
-
Method Details
-
addHeader
Description copied from interface:JettyServerUpgradeResponseAdd a header value to the response.- Specified by:
addHeaderin interfaceJettyServerUpgradeResponse- Parameters:
name- the header namevalue- the header value
-
setHeader
Description copied from interface:JettyServerUpgradeResponseSet a headerOverrides previous value of header (if set)
- Specified by:
setHeaderin interfaceJettyServerUpgradeResponse- Parameters:
name- the header namevalue- the header value
-
setHeader
Description copied from interface:JettyServerUpgradeResponseSet a headerOverrides previous value of header (if set)
- Specified by:
setHeaderin interfaceJettyServerUpgradeResponse- Parameters:
name- the header namevalues- the header values
-
getAcceptedSubProtocol
Description copied from interface:UpgradeResponseGet the accepted WebSocket protocol.- Specified by:
getAcceptedSubProtocolin interfaceUpgradeResponse- Returns:
- the accepted WebSocket protocol.
-
getExtensions
Description copied from interface:UpgradeResponseGet the list of extensions that should be used for the websocket.- Specified by:
getExtensionsin interfaceUpgradeResponse- Returns:
- the list of negotiated extensions to use.
-
getHeader
Description copied from interface:UpgradeResponseGet a header value- Specified by:
getHeaderin interfaceUpgradeResponse- Parameters:
name- the header name- Returns:
- the value (null if header doesn't exist)
-
getHeaderNames
Description copied from interface:UpgradeResponseGet the header names- Specified by:
getHeaderNamesin interfaceUpgradeResponse- Returns:
- the set of header names
-
getHeaders
Description copied from interface:UpgradeResponseGet the headers map- Specified by:
getHeadersin interfaceUpgradeResponse- Returns:
- the map of headers
-
getHeaders
Description copied from interface:UpgradeResponseGet the multi-value header value- Specified by:
getHeadersin 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:UpgradeResponseGet the HTTP Response Status Code- Specified by:
getStatusCodein interfaceUpgradeResponse- Returns:
- the status code
-
sendForbidden
Description copied from interface:JettyServerUpgradeResponseIssue 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 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:JettyServerUpgradeResponseSet the accepted WebSocket Protocol.- Specified by:
setAcceptedSubProtocolin interfaceJettyServerUpgradeResponse- Parameters:
protocol- the protocol to list as accepted
-
setExtensions
Description copied from interface:JettyServerUpgradeResponseSet 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 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:JettyServerUpgradeResponseSet the HTTP Response status code- Specified by:
setStatusCodein interfaceJettyServerUpgradeResponse- Parameters:
statusCode- the status code
-
isCommitted
public boolean isCommitted()Description copied from interface:JettyServerUpgradeResponseReturns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.- Specified by:
isCommittedin interfaceJettyServerUpgradeResponse- Returns:
- a boolean indicating if the response has been committed.
-
sendError
Description copied from interface:JettyServerUpgradeResponseSends an error response to the client using the specified status.- Specified by:
sendErrorin interfaceJettyServerUpgradeResponse- Parameters:
statusCode- the error status codemessage- the descriptive message- Throws:
IOException- If an input or output exception occurs
-