Package org.glassfish.tyrus.client
Class TyrusClientEngine
- java.lang.Object
-
- org.glassfish.tyrus.client.TyrusClientEngine
-
- All Implemented Interfaces:
ClientEngine
public class TyrusClientEngine extends java.lang.Object implements ClientEngine
TyrusClientEngine
implementation.- Author:
- Pavel Bucek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TyrusClientEngine.ClientHandshakeListener
Called when response is received from the server.-
Nested classes/interfaces inherited from interface org.glassfish.tyrus.spi.ClientEngine
ClientEngine.ClientUpgradeInfo, ClientEngine.ClientUpgradeStatus, ClientEngine.TimeoutHandler
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INCOMING_BUFFER_SIZE
Default incoming buffer size for client container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpgradeRequest
createUpgradeRequest(ClientEngine.TimeoutHandler timeoutHandler)
Create upgrade request and registerClientEngine.TimeoutHandler
.ClientEngine.TimeoutHandler
getTimeoutHandler()
GetClientEngine.TimeoutHandler
associated with currentClientEngine
instance.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
).
-
-
-
Field Detail
-
DEFAULT_INCOMING_BUFFER_SIZE
public static final int DEFAULT_INCOMING_BUFFER_SIZE
Default incoming buffer size for client container.- See Also:
- Constant Field Values
-
-
Method Detail
-
createUpgradeRequest
public UpgradeRequest createUpgradeRequest(ClientEngine.TimeoutHandler timeoutHandler)
Description copied from interface:ClientEngine
Create upgrade request and registerClientEngine.TimeoutHandler
.- Specified by:
createUpgradeRequest
in interfaceClientEngine
- Parameters:
timeoutHandler
- handshake timeout handler.ClientEngine.TimeoutHandler.handleTimeout()
is invoked ifClientEngine.processResponse(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
public ClientEngine.ClientUpgradeInfo processResponse(UpgradeResponse upgradeResponse, Writer writer, Connection.CloseListener closeListener)
Description copied from interface:ClientEngine
Process handshake and returnClientEngine.ClientUpgradeInfo
with handshake status (ClientEngine.ClientUpgradeStatus
).- Specified by:
processResponse
in interfaceClientEngine
- 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:
ClientEngine.processError(Throwable)
-
processError
public void processError(java.lang.Throwable t)
Description copied from interface:ClientEngine
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 fromClientEngine.processResponse(UpgradeResponse, Writer, Connection.CloseListener)
.- Specified by:
processError
in interfaceClientEngine
- Parameters:
t
- encountered error.- See Also:
ClientEngine.processResponse(UpgradeResponse, Writer, Connection.CloseListener)
-
getTimeoutHandler
public ClientEngine.TimeoutHandler getTimeoutHandler()
GetClientEngine.TimeoutHandler
associated with currentClientEngine
instance.- Returns:
- timeout handler instance or
null
when not present.
-
-