Package org.glassfish.tyrus.spi
Interface ClientEngine
- All Known Implementing Classes:
TyrusClientEngine
public interface ClientEngine
Facade for handling client operations from containers.
- Author:
- Pavel Bucek, Ondrej Kosatka
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Upgrade process result.static enum
Status of upgrade process.static interface
Indicates to container that handshake timeout was reached. -
Method Summary
Modifier and TypeMethodDescriptioncreateUpgradeRequest
(ClientEngine.TimeoutHandler timeoutHandler) Create upgrade request and registerClientEngine.TimeoutHandler
.void
Process error.processResponse
(UpgradeResponse upgradeResponse, Writer writer, Connection.CloseListener closeListener) Process handshake and returnClientEngine.ClientUpgradeInfo
with handshake status (ClientEngine.ClientUpgradeStatus
).
-
Method Details
-
createUpgradeRequest
Create upgrade request and registerClientEngine.TimeoutHandler
.- Parameters:
timeoutHandler
- handshake timeout handler.ClientEngine.TimeoutHandler.handleTimeout()
is invoked ifprocessResponse(UpgradeResponse, Writer, Connection.CloseListener)
is not called within handshake timeout.- Returns:
- request to be send on the wire or
null
, when the request cannot be created. Whennull
is returned, client should free all resources tied to current connection.
-
processResponse
ClientEngine.ClientUpgradeInfo processResponse(UpgradeResponse upgradeResponse, Writer writer, Connection.CloseListener closeListener) Process handshake and returnClientEngine.ClientUpgradeInfo
with handshake status (ClientEngine.ClientUpgradeStatus
).- Parameters:
upgradeResponse
- response to be processed.writer
- used for sending dataframes from client endpoint.closeListener
- will be called when connection is closed, will be set as listener of returnedConnection
.- Returns:
- info with upgrade status.
- See Also:
-
processError
Process error.This method can be called any time when client encounters an error which cannot be handled in the container before
ClientEngine.ClientUpgradeStatus.SUCCESS
is returned fromprocessResponse(UpgradeResponse, Writer, Connection.CloseListener)
.- Parameters:
t
- encountered error.- See Also:
-