Interface JettyServerUpgradeResponse
-
- All Superinterfaces:
org.eclipse.jetty.websocket.api.UpgradeResponse
public interface JettyServerUpgradeResponse extends org.eclipse.jetty.websocket.api.UpgradeResponse
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddHeader(java.lang.String name, java.lang.String value)Add a header value to the response.booleanisCommitted()Returns a boolean indicating if the response has been committed.voidsendError(int statusCode, java.lang.String message)Sends an error response to the client using the specified status.voidsendForbidden(java.lang.String message)Issue a forbidden upgrade response.voidsetAcceptedSubProtocol(java.lang.String protocol)Set the accepted WebSocket Protocol.voidsetExtensions(java.util.List<org.eclipse.jetty.websocket.api.ExtensionConfig> extensions)Set the list of extensions that are approved for use with this websocket.voidsetHeader(java.lang.String name, java.lang.String value)Set a headervoidsetHeader(java.lang.String name, java.util.List<java.lang.String> values)Set a headervoidsetStatusCode(int statusCode)Set the HTTP Response status code
-
-
-
Method Detail
-
addHeader
void addHeader(java.lang.String name, java.lang.String value)Add a header value to the response.- Parameters:
name- the header namevalue- the header value
-
setHeader
void setHeader(java.lang.String name, java.lang.String value)Set a headerOverrides previous value of header (if set)
- Parameters:
name- the header namevalue- the header value
-
setHeader
void setHeader(java.lang.String name, java.util.List<java.lang.String> values)Set a headerOverrides previous value of header (if set)
- Parameters:
name- the header namevalues- the header values
-
sendForbidden
void sendForbidden(java.lang.String message) throws java.io.IOExceptionIssue 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.
- Parameters:
message- the short 1 line detail message about the forbidden response- Throws:
java.io.IOException- if unable to send the forbidden
-
sendError
void sendError(int statusCode, java.lang.String message) throws java.io.IOExceptionSends an error response to the client using the specified status.- Parameters:
statusCode- the error status codemessage- the descriptive message- Throws:
java.io.IOException- If an input or output exception occursjava.lang.IllegalStateException- If the response was committed
-
setAcceptedSubProtocol
void setAcceptedSubProtocol(java.lang.String protocol)
Set the accepted WebSocket Protocol.- Parameters:
protocol- the protocol to list as accepted
-
setExtensions
void setExtensions(java.util.List<org.eclipse.jetty.websocket.api.ExtensionConfig> extensions)
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.
- Parameters:
extensions- the list of extensions to use.
- Per the spec you cannot add extensions that have not been seen in the
-
setStatusCode
void setStatusCode(int statusCode)
Set the HTTP Response status code- Parameters:
statusCode- the status code
-
isCommitted
boolean isCommitted()
Returns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.- Returns:
- a boolean indicating if the response has been committed.
-
-