Method Summary |
|
void | addEvent(ClientEvent event) Adds the ClientEvent. |
void | clean() |
void | closeConnection() Closes client socket associated. |
void | forceClose() Force the closing of the client by closing the associated socket. |
Logger | getAppLogger() Returns client SelectionKey associated, if any. |
BufferedInputStream | getBufferedInputStream() Returns the
java.io.BufferedInputStream associated with
the Client being handled. |
BufferedOutputStream | getBufferedOutputStream() Returns the
java.io.BufferedOutputStream associated with
the Client being handled. |
BufferedReader | getBufferedReader() Returns the
java.io.BufferedReader associated with
the Client being handled. |
BufferedWriter | getBufferedWriter() Returns the
java.io.BufferedWriter associated with
the Client being handled. |
String | getCharset() Returns Charset to be used for String decoding and encoding.. |
Date | getClientConnectedTime() Returns the date/time when the client socket was assigned to this
ClientHanlder. |
ClientData | getClientData() |
boolean | getCommunicationLogging() Returns the communication logging flag. |
Connection | getConnection(String id) Returns the
java.sql.Connection object for the
DatabaseConnection that is identified by id passed. |
DataMode | getDataMode(DataType dataType) Returns the
DataMode of the ClientHandler for the
DataType. |
String | getHostAddress() Returns cached socket host ip address. |
InputStream | getInputStream() Returns the
java.io.InputStream associated with
the Client being handled. |
Date | getLastCommunicationTime() Returns the date/time when the client socket last sent a data to this
ClientHanlder. |
String | getMaxConnectionMsg() Returns message to be displayed to the client when maximum
connection reaches. |
String | getName() |
ObjectInputStream | getObjectInputStream() Returns the
java.io.ObjectInputStream associated with
the Client being handled. |
ObjectOutputStream | getObjectOutputStream() Returns the
java.io.ObjectOutputStream associated with
the Client being handled. |
OutputStream | getOutputStream() Returns the
java.io.OutputStream associated with
the Client being handled. |
SelectionKey | getSelectionKey() Returns client SelectionKey associated, if any. |
QuickServer | getServer() Returns the QuickServer object that created it. |
Socket | getSocket() Returns client socket associated. |
SocketChannel | getSocketChannel() Returns client socket channel associated, if any. |
int | getTimeout() Returns the Client socket timeout in milliseconds. |
void | handleClient(TheClient theClient) Associates the ClientHanlder with the client encapsulated by
theClient . |
boolean | hasEvent(ClientEvent event) Checks if this client has the event. |
String | info() Returns the ClientHandler detailed information. |
boolean | isClientEventNext(ClientEvent clientEvent) Checks if the passed ClientEvent is the one next for
processing if a thread is allowed through this object. |
boolean | isClosed() Checks if the client is closed. |
boolean | isConected() Checks if the client is still connected. |
boolean | isConnected() Checks if the client is still connected. |
boolean | isOpen() Checks if the client is still connected and if socket is open. |
boolean | isSecure() Returns flag indicating if the client is connected in secure mode
(SSL or TLS). |
void | makeSecure() Makes current Client connection to secure protocol based on the
secure configuration set to the server. |
void | makeSecure(boolean useClientMode, boolean needClientAuth, boolean autoClose, String protocol) Makes current Client connection to secure protocol.
Parameters: useClientMode - falg if the socket should start its first handshake in "client" mode. Parameters: needClientAuth - flag if the clients must authenticate themselves. Parameters: autoClose - close the underlying socket when this socket is closed Parameters: protocol - the standard name of the requested protocol. |
void | makeSecure(String protocol) Makes current Client connection to secure protocol. |
byte[] | readBinary() Read the binary input. |
String | readBytes() Read the byte input. |
void | registerForRead() Register OP_READ with the SelectionKey associated with the channel. |
void | registerForWrite() Register OP_WRITE with the SelectionKey associated with the channel. |
void | removeEvent(ClientEvent event) Removes the ClientEvent. |
void | run() |
void | sendClientBinary(byte[] data) Send a binary data to the connected client. |
void | sendClientBinary(byte[] data, int off, int len) Send a binary data to the connected client. |
void | sendClientBytes(String msg) Send a String message to the connected client as a string of bytes. |
void | sendClientMsg(String msg) Send a String message to the connected client
it adds a new line{\r\n} to the end of the string. |
void | sendClientObject(Object msg) Send a Object message to the connected client. |
void | sendSystemMsg(String msg) Send a String message to the logger associated with
QuickServer.getAppLogger with Level.INFO as its level. |
void | sendSystemMsg(String msg, Level level) Send a String message to the logger associated with
QuickServer.getAppLogger . |
void | sendSystemMsg(String msg, boolean newline) Send a String message to the system output stream. |
void | setCharset(String charset) Sets the Charset to be used for String decoding and encoding. |
void | setCommunicationLogging(boolean communicationLogging) Sets the communication logging flag. |
void | setDataMode(DataMode dataMode, DataType dataType) Sets the
DataMode for the ClientHandler
Note: When mode is DataMode.OBJECT and type is DataType.IN
this call will block until the client ObjectOutputStream has
written and flushes the header. |
void | setMaxConnectionMsg(String msg) Sets message to be displayed when maximum connection reaches. |
void | setOutputStream(OutputStream out) Set the
java.io.OutputStream associated with
the Client being handled. |
void | setSecure(boolean secure) Sets flag indicating if the client is connected in secure mode
(SSL or TLS). |
void | setSelectionKey(SelectionKey selectionKey) Sets client SelectionKey associated, if any. |
void | setSocket(Socket socket) Returns client socket associated. |
void | setSocketChannel(SocketChannel socketChannel) Sets client socket channel associated, if any. |
void | setTimeout(int time) Sets the client socket's timeout. |
String | toString() Returns the ClientHandler information. |
void | updateInputOutputStreams() Updates the InputStream and OutputStream for the ClientHandler for the
set Socket. |
void | updateLastCommunicationTime() |