Class AbstractHandshaker
- All Implemented Interfaces:
Handshaker
- Direct Known Subclasses:
RFC6455Handshaker,RFC8441Handshaker
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract WebSocketConnectioncreateWebSocketConnection(Request baseRequest, WebSocketCoreSession coreSession) booleanisWebSocketUpgradeRequest(Request request) A preliminary check to see if a request is likely to be a valid WebSocket Upgrade Request.protected abstract WebSocketNegotiationnewNegotiation(Request request, Response response, Callback callback, WebSocketComponents webSocketComponents) protected WebSocketConnectionnewWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) protected WebSocketCoreSessionnewWebSocketCoreSession(Request request, FrameHandler handler, Negotiated negotiated, WebSocketComponents components) protected abstract voidprepareResponse(Response response, WebSocketNegotiation negotiation) booleanupgradeRequest(WebSocketNegotiator negotiator, Request request, Response response, Callback callback, WebSocketComponents components, Configuration.Customizer defaultCustomizer) Attempts to upgrade a request to WebSocket.protected booleanvalidateNegotiation(WebSocketNegotiation negotiation)
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
AbstractHandshaker
public AbstractHandshaker()
-
-
Method Details
-
upgradeRequest
public boolean upgradeRequest(WebSocketNegotiator negotiator, Request request, Response response, Callback callback, WebSocketComponents components, Configuration.Customizer defaultCustomizer) throws WebSocketException Description copied from interface:HandshakerAttempts to upgrade a request to WebSocket.
Returns
trueif the WebSocket upgrade is successful and a successful response is generated and the callback eventually completed, or if the WebSocket upgrade failed and a failure response is generated and the callback eventually completed. Returnsfalseif a response is not generated and the caller is responsible for generating a response and completing the callback.- Specified by:
upgradeRequestin interfaceHandshaker- Parameters:
negotiator- the negotiatorrequest- the requestresponse- the responsecallback- the callbackcomponents- the WebSocket componentsdefaultCustomizer- the customizer- Returns:
- true if a response was generated, false if a response is not generated
- Throws:
WebSocketException- there is an error during the upgrade
-
newNegotiation
protected abstract WebSocketNegotiation newNegotiation(Request request, Response response, Callback callback, WebSocketComponents webSocketComponents) -
isWebSocketUpgradeRequest
Description copied from interface:HandshakerA preliminary check to see if a request is likely to be a valid WebSocket Upgrade Request. If this returns true the
Requestmay be a valid upgrade request, but if this returns false returns false you can avoid callingHandshaker.upgradeRequest(WebSocketNegotiator, Request, Response, Callback, WebSocketComponents, Configuration.Customizer)entirely as it will always fail- Specified by:
isWebSocketUpgradeRequestin interfaceHandshaker- Parameters:
request- the request- Returns:
- true if the request is thought to be a valid websocket upgrade request.
-
validateNegotiation
-
newWebSocketCoreSession
protected WebSocketCoreSession newWebSocketCoreSession(Request request, FrameHandler handler, Negotiated negotiated, WebSocketComponents components) -
createWebSocketConnection
protected abstract WebSocketConnection createWebSocketConnection(Request baseRequest, WebSocketCoreSession coreSession) -
newWebSocketConnection
protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) -
prepareResponse
-