Package com.iizix.comm.test
Class TransactionProcessor
java.lang.Object
com.iizix.comm.test.TransactionProcessor
- All Implemented Interfaces:
TransactionCommListener
,WebSocketAcceptor
public class TransactionProcessor extends Object implements WebSocketAcceptor, TransactionCommListener
The transaction processor for inbound connections from WebSockets.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionString[]
Gets the list of potential handled context paths for the websocket.isRequestURIAccepted
(IWebSocketComm comm, String uri, Map<String, List<String>> headerFields) Called to check if a request URI can be accepted.void
onCommClosed
(TransactionComm comm, int code, String reason) Called when the communication link is closed.void
onCommClosing
(TransactionComm comm) Called when the communication link is closing.void
Called when the communication link is connected.void
onCommData
(TransactionComm comm, ReadTransaction trans, int size) Called when the communication link has received data.void
onCommError
(TransactionComm comm, Throwable e) Called when the communication link is closed.void
onCommHeartBeat
(TransactionComm comm, long duration) Called when a heart-beat frame is received.void
onCommTimeout
(TransactionComm comm, boolean isReadTimeout) Called when the communication link has timed out on a read or write operation.
Method Details
getHandledContextPaths
Gets the list of potential handled context paths for the websocket.- Specified by:
getHandledContextPaths
in interfaceWebSocketAcceptor
- Returns:
- The array of possibly handled context paths.
isRequestURIAccepted
public Object isRequestURIAccepted(IWebSocketComm comm, String uri, Map<String, List<String>> headerFields) Called to check if a request URI can be accepted.- Specified by:
isRequestURIAccepted
in interfaceWebSocketAcceptor
- Parameters:
comm
- The WebSocket communication instance.uri
- The request URI, formatted as e.g. "/something/more.ws?query-params".headerFields
- HTTP header fields.- Returns:
- Object an object that is attached to the TransactionComm instance, or null if the URI is not accepted.
onCommConnected
Called when the communication link is connected.- Specified by:
onCommConnected
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.
onCommData
Called when the communication link has received data.- Specified by:
onCommData
in interfaceTransactionCommListener
- Parameters:
comm
- The socket communication instance.trans
- The transaction received.size
- The size of the data received, as it may have been uncompressed.
onCommHeartBeat
Called when a heart-beat frame is received.- Specified by:
onCommHeartBeat
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.duration
- Duration of the PING-PONG message exchange in milliseconds.
onCommTimeout
Called when the communication link has timed out on a read or write operation.- Specified by:
onCommTimeout
in interfaceTransactionCommListener
- Parameters:
comm
- The transaction communication instance.isReadTimeout
- Flag indicating read timeout when true, false indicates write timeout.
onCommError
Called when the communication link is closed.- Specified by:
onCommError
in interfaceTransactionCommListener
- Parameters:
comm
- The socket communication instance.e
- The exception.
onCommClosing
Called when the communication link is closing.- Specified by:
onCommClosing
in interfaceTransactionCommListener
- Parameters:
comm
- The socket communication instance.
onCommClosed
Called when the communication link is closed.- Specified by:
onCommClosed
in interfaceTransactionCommListener
- Parameters:
comm
- The socket communication instance.