Top Fields Constructors Methods
org.eclipse.jetty.websocket.core.server.internal

public abstract Class AbstractHandshaker

extends Object
implements Handshaker
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.websocket.core.server.Handshaker
Known Direct Subclasses
org.eclipse.jetty.websocket.core.server.internal.RFC6455Handshaker, org.eclipse.jetty.websocket.core.server.internal.RFC8441Handshaker
Imports
java.util.List, java.util.concurrent.Executor, org.eclipse.jetty.http.HttpField, .HttpHeader, .PreEncodedHttpField, org.eclipse.jetty.io.ByteBufferPool, .EndPoint, org.eclipse.jetty.server.ConnectionMetaData, .Context, .HttpConfiguration, .HttpStream, .Request, .Response, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.thread.Scheduler, org.eclipse.jetty.websocket.core.Behavior, .Configuration, .ExtensionConfig, .ExtensionStack, .FrameHandler, .Negotiated, .WebSocketComponents, .WebSocketConnection, .WebSocketConstants, .WebSocketCoreSession, org.eclipse.jetty.websocket.core.exception.WebSocketException, org.eclipse.jetty.websocket.core.server.Handshaker, .WebSocketNegotiator, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
protected static final Logger
private static final HttpField

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract WebSocketConnection
public boolean
isWebSocketUpgradeRequest(Request
the request
request
)

Implements org.eclipse.jetty.websocket.core.server.Handshaker.isWebSocketUpgradeRequest.

A preliminary check to see if a request is likely to be a valid WebSocket Upgrade Request.

protected abstract WebSocketNegotiation
newNegotiation(Request request, Response response, Callback callback, WebSocketComponents webSocketComponents)

protected WebSocketConnection
newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession)

protected WebSocketCoreSession
protected abstract void
public boolean
upgradeRequest(WebSocketNegotiator
the negotiator
negotiator
,
Request
the request
request
,
Response
the response
response
,
Callback
the callback
callback
,
WebSocketComponents
the WebSocket components
components
,
Configuration.Customizer
the customizer
defaultCustomizer
)

Implements org.eclipse.jetty.websocket.core.server.Handshaker.upgradeRequest.

Attempts to upgrade a request to WebSocket.

protected boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
protected static final Logger LOG
SERVER_VERSIONback to summary
private static final HttpField SERVER_VERSION

Constructor Detail

AbstractHandshakerback to summary
public AbstractHandshaker()

Method Detail

createWebSocketConnectionback to summary
protected abstract WebSocketConnection createWebSocketConnection(Request baseRequest, WebSocketCoreSession coreSession)
isWebSocketUpgradeRequestback to summary
public boolean isWebSocketUpgradeRequest(Request request)

Implements org.eclipse.jetty.websocket.core.server.Handshaker.isWebSocketUpgradeRequest.

Doc from org.eclipse.jetty.websocket.core.server.Handshaker.isWebSocketUpgradeRequest.

A preliminary check to see if a request is likely to be a valid WebSocket Upgrade Request. If this returns true the Request may be a valid upgrade request, but if this returns false returns false you can avoid calling upgradeRequest(WebSocketNegotiator, Request, Response, Callback, WebSocketComponents, Configuration.Customizer) entirely as it will always fail

Parameters
request:Request

the request

Returns:boolean

true if the request is thought to be a valid websocket upgrade request.

Annotations
@Override
newNegotiationback to summary
protected abstract WebSocketNegotiation newNegotiation(Request request, Response response, Callback callback, WebSocketComponents webSocketComponents)
newWebSocketConnectionback to summary
protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession)
newWebSocketCoreSessionback to summary
protected WebSocketCoreSession newWebSocketCoreSession(Request request, FrameHandler handler, Negotiated negotiated, WebSocketComponents components)
prepareResponseback to summary
protected abstract void prepareResponse(Response response, WebSocketNegotiation negotiation)
upgradeRequestback to summary
public boolean upgradeRequest(WebSocketNegotiator negotiator, Request request, Response response, Callback callback, WebSocketComponents components, Configuration.Customizer defaultCustomizer) throws WebSocketException

Implements org.eclipse.jetty.websocket.core.server.Handshaker.upgradeRequest.

Doc from org.eclipse.jetty.websocket.core.server.Handshaker.upgradeRequest.

Attempts to upgrade a request to WebSocket.

Returns true if 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. Returns false if a response is not generated and the caller is responsible for generating a response and completing the callback.

Parameters
negotiator:WebSocketNegotiator

the negotiator

request:Request

the request

response:Response

the response

callback:Callback

the callback

components:WebSocketComponents

the WebSocket components

defaultCustomizer:Configuration.Customizer

the customizer

Returns:boolean

true if a response was generated, false if a response is not generated

Annotations
@Override
Exceptions
WebSocketException:
there is an error during the upgrade
validateNegotiationback to summary
protected boolean validateNegotiation(WebSocketNegotiation negotiation)