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
Nested Classes Modifier and Type Interface Description static interface
ClientEngine.ClientUpgradeInfo
Upgrade process result.static class
ClientEngine.ClientUpgradeStatus
Status of upgrade process.static interface
ClientEngine.TimeoutHandler
Indicates to container that handshake timeout was reached.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UpgradeRequest
createUpgradeRequest(ClientEngine.TimeoutHandler timeoutHandler)
Create upgrade request and registerClientEngine.TimeoutHandler
.void
processError(java.lang.Throwable t)
Process error.ClientEngine.ClientUpgradeInfo
processResponse(UpgradeResponse upgradeResponse, Writer writer, Connection.CloseListener closeListener)
Process handshake and returnClientEngine.ClientUpgradeInfo
with handshake status (ClientEngine.ClientUpgradeStatus
).
-
-
-
Method Detail
-
createUpgradeRequest
UpgradeRequest createUpgradeRequest(ClientEngine.TimeoutHandler timeoutHandler)
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(Throwable)
-
processError
void processError(java.lang.Throwable t)
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:
processResponse(UpgradeResponse, Writer, Connection.CloseListener)
-
-