public abstract class BasicClientHandler extends java.lang.Object implements ClientHandler
This class is used by QuickServer to handle each new client
connected. This class is responsible to handle client sockets. It can operate
in both blocking mode and non-blocking mode (java nio).
Contributions By: Martin Benns : BYTE Mode
| Modifier and Type | Field and Description |
|---|---|
protected java.util.logging.Logger |
appLogger |
protected Authenticator |
authenticator |
protected boolean |
authorised
Client authorisation status
|
protected java.io.BufferedInputStream |
b_in |
protected java.io.BufferedOutputStream |
b_out |
protected java.io.BufferedReader |
bufferedReader |
protected java.lang.String |
charset |
protected ClientAuthenticationHandler |
clientAuthenticationHandler |
protected ClientBinaryHandler |
clientBinaryHandler |
protected ClientCommandHandler |
clientCommandHandler |
protected java.util.Date |
clientConnectedTime |
protected ClientData |
clientData |
protected ClientEventHandler |
clientEventHandler |
protected java.util.Set |
clientEvents |
protected ClientExtendedEventHandler |
clientExtendedEventHandler |
protected ClientObjectHandler |
clientObjectHandler |
protected boolean |
closeOrLostNotified |
protected boolean |
communicationLogging |
protected boolean |
connection |
protected int |
counAuthTry
Count of client login attempts
|
protected DataMode |
dataModeIN |
protected DataMode |
dataModeOUT |
protected java.io.InputStream |
in |
protected java.util.Date |
lastCommunicationTime |
protected java.lang.Object |
lockObj |
protected boolean |
lost |
protected int |
maxAuthTry
max allowed login attempts
|
protected java.lang.String |
maxAuthTryMsg
Message to be displayed when max login attempt reaches.
|
protected java.lang.String |
maxConnectionMsg |
protected static java.lang.String |
NEW_LINE |
protected static byte[] |
NEW_LINE_BYTES |
protected java.io.ObjectInputStream |
o_in |
protected java.io.ObjectOutputStream |
o_out |
protected java.io.OutputStream |
out |
protected QuickServer |
quickServer |
protected boolean |
secure |
protected java.net.Socket |
socket
Client socket
|
protected int |
socketTimeout |
protected javax.net.ssl.SSLEngine |
sslEngine |
protected static java.lang.ThreadLocal |
threadEvent |
protected java.lang.String |
timeoutMsg
timeout message
|
protected int |
totalReadBytes |
protected int |
totalWrittenBytes |
protected java.util.concurrent.ConcurrentLinkedQueue |
unprocessedClientEvents |
protected boolean |
willClean |
| Constructor and Description |
|---|
BasicClientHandler() |
BasicClientHandler(int instanceCount) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEvent(ClientEvent event)
Adds the ClientEvent.
|
protected void |
assertionSystemExit() |
protected void |
checkDataModeSet(DataMode dataMode,
DataType dataType) |
void |
clean() |
abstract void |
closeConnection()
Closes client socket associated.
|
void |
forceClose()
Force the closing of the client by closing the associated socket.
|
java.util.logging.Logger |
getAppLogger()
Returns client SelectionKey associated, if any.
|
abstract boolean |
getBlockingMode()
Returns the current blocking mode of the server.
|
java.io.BufferedInputStream |
getBufferedInputStream()
Returns the
BufferedInputStream associated with
the Client being handled. |
java.io.BufferedOutputStream |
getBufferedOutputStream()
Returns the
BufferedOutputStream associated with
the Client being handled. |
abstract java.io.BufferedReader |
getBufferedReader()
Returns the
BufferedReader associated with
the Client being handled. |
java.io.BufferedWriter |
getBufferedWriter()
Deprecated.
since 1.4.5 use getOutputStream()
|
java.lang.String |
getCharset()
Returns Charset to be used for String decoding and encoding..
|
java.util.Date |
getClientConnectedTime()
Returns the date/time when the client socket was assigned to this
ClientHanlder.
|
ClientData |
getClientData()
Returns the ClientData object associated with this ClientHandler,
if not set will return
null |
protected static java.lang.String |
getClientIdentifiable(ClientHandler foundClientHandler) |
boolean |
getCommunicationLogging()
Returns the communication logging flag.
|
java.sql.Connection |
getConnection(java.lang.String id)
Deprecated.
as of v1.4.5 use
getServer().getDBPoolUtil().getConnection(id) |
DataMode |
getDataMode(DataType dataType)
Returns the
DataMode of the ClientHandler for the
DataType. |
java.lang.String |
getHostAddress()
Returns cached socket host ip address.
|
java.io.InputStream |
getInputStream()
Returns the
InputStream associated with
the Client being handled. |
int |
getInstanceCount() |
java.util.Date |
getLastCommunicationTime()
Returns the date/time when the client socket last sent a data to this
ClientHanlder.
|
java.lang.String |
getMaxConnectionMsg()
Returns message to be displayed to the client when maximum
connection reaches.
|
java.lang.String |
getName()
Returns the ClientHandler name
|
java.io.ObjectInputStream |
getObjectInputStream()
Returns the
ObjectInputStream associated with
the Client being handled. |
java.io.ObjectOutputStream |
getObjectOutputStream()
Returns the
ObjectOutputStream associated with
the Client being handled. |
java.io.OutputStream |
getOutputStream()
Returns the
OutputStream associated with
the Client being handled. |
abstract java.nio.channels.SelectionKey |
getSelectionKey()
Returns client SelectionKey associated, if any.
|
QuickServer |
getServer()
Returns the QuickServer object that created it.
|
java.net.Socket |
getSocket()
Returns client socket associated.
|
abstract java.nio.channels.SocketChannel |
getSocketChannel()
Returns client socket channel associated, if any.
|
javax.net.ssl.SSLEngine |
getSSLEngine()
Returns SSLEngine if in secure mode.
|
protected ClientEvent |
getThreadEvent()
Returns threads current event for this client.
|
int |
getTimeout()
Returns the Client socket timeout in milliseconds.
|
int |
getTotalReadBytes() |
int |
getTotalWrittenBytes() |
boolean |
getWillClean() |
void |
handleClient(TheClient theClient)
Associates the ClientHanlder with the client encapsulated by
theClient. |
protected void |
handleTimeout(java.net.SocketTimeoutException e) |
boolean |
hasEvent(ClientEvent event)
Checks if this client has the event.
|
java.lang.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()
Deprecated.
since 1.4.5 Use
isConnected() |
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,
java.lang.String protocol)
Makes current Client connection to secure protocol.
|
void |
makeSecure(java.lang.String protocol)
Makes current Client connection to secure protocol.
|
protected void |
notifyCloseOrLost() |
protected void |
prepareForRun() |
protected AuthStatus |
processAuthorisation() |
protected void |
processMaxConnection(ClientEvent currentEvent) |
byte[] |
readBinary()
Read the binary input.
|
java.lang.String |
readBytes()
Read the byte input.
|
protected abstract byte[] |
readInputStream()
Read the byte input.
|
protected static byte[] |
readInputStream(java.io.InputStream _in) |
abstract void |
registerForRead()
Register OP_READ with the SelectionKey associated with the channel.
|
abstract void |
registerForWrite()
Register OP_WRITE with the SelectionKey associated with the channel.
|
void |
removeEvent(ClientEvent event)
Removes the ClientEvent.
|
void |
resetTotalReadBytes() |
void |
resetTotalWrittenBytes() |
protected void |
returnClientData() |
protected void |
returnClientHandler() |
abstract 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(java.lang.String msg)
Send a String message to the connected client as a string of bytes.
|
void |
sendClientMsg(java.lang.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(java.lang.Object msg)
Send a Object message to the connected client.
|
void |
sendSystemMsg(java.lang.String msg)
Send a String message to the logger associated with
QuickServer.getAppLogger() with Level.INFO as its level. |
void |
sendSystemMsg(java.lang.String msg,
boolean newline)
Deprecated.
Use
sendSystemMsg(java.lang.String),
since it uses Logging. |
void |
sendSystemMsg(java.lang.String msg,
java.util.logging.Level level)
Send a String message to the logger associated with
QuickServer.getAppLogger(). |
protected void |
setAuthenticator(Authenticator authenticator)
Sets the Authenticator class that handles the
authentication of a client.
|
void |
setCharset(java.lang.String charset)
Sets the Charset to be used for String decoding and encoding.
|
protected void |
setClientAuthenticationHandler(ClientAuthenticationHandler clientAuthenticationHandler)
Sets the ClientAuthenticationHandler class that handles the
authentication of a client.
|
protected void |
setClientBinaryHandler(ClientBinaryHandler handler)
Sets the ClientBinaryHandler class that interacts with
client sockets.
|
protected void |
setClientCommandHandler(ClientCommandHandler handler)
Sets the ClientCommandHandler class that interacts with
client sockets.
|
protected void |
setClientData(ClientData data)
Sets the ClientData object associated with this ClientHandler
|
protected void |
setClientEventHandler(ClientEventHandler handler)
Sets the ClientEventHandler class that gets notified of client events.
|
protected void |
setClientExtendedEventHandler(ClientExtendedEventHandler handler)
Sets the ClientExtendedEventHandler class that gets notified of extended client events.
|
protected void |
setClientObjectHandler(ClientObjectHandler handler)
Sets the ClientObjectHandler class that interacts with
client sockets.
|
protected abstract void |
setClientWriteHandler(ClientWriteHandler handler)
Sets the ClientWriteHandler class that interacts with
client sockets.
|
void |
setCommunicationLogging(boolean communicationLogging)
Sets the communication logging flag.
|
abstract 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. |
protected abstract void |
setInputStream(java.io.InputStream in)
Sets the
InputStream associated with
the Client being handled. |
void |
setMaxConnectionMsg(java.lang.String msg)
Sets message to be displayed when maximum connection reaches.
|
void |
setOutputStream(java.io.OutputStream out)
Set the
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).
|
abstract void |
setSelectionKey(java.nio.channels.SelectionKey selectionKey)
Sets client SelectionKey associated, if any.
|
protected void |
setServer(QuickServer server)
Sets the QuickServer object associated with this ClientHandler.
|
void |
setSocket(java.net.Socket socket)
Returns client socket associated.
|
abstract void |
setSocketChannel(java.nio.channels.SocketChannel socketChannel)
Sets client socket channel associated, if any.
|
void |
setTimeout(int time)
Sets the client socket's timeout.
|
java.lang.String |
toString()
Returns the ClientHandler information.
|
abstract void |
updateInputOutputStreams()
Updates the InputStream and OutputStream for the ClientHandler for the
set Socket.
|
void |
updateLastCommunicationTime()
Updates the last communication time for this client
|
protected static final java.lang.String NEW_LINE
protected static final byte[] NEW_LINE_BYTES
protected java.net.Socket socket
protected volatile boolean authorised
protected int counAuthTry
protected int maxAuthTry
protected java.lang.String timeoutMsg
protected java.lang.String maxAuthTryMsg
protected int socketTimeout
protected volatile boolean connection
protected boolean lost
protected QuickServer quickServer
protected Authenticator authenticator
protected ClientAuthenticationHandler clientAuthenticationHandler
protected ClientEventHandler clientEventHandler
protected ClientExtendedEventHandler clientExtendedEventHandler
protected ClientCommandHandler clientCommandHandler
protected ClientObjectHandler clientObjectHandler
protected ClientBinaryHandler clientBinaryHandler
protected ClientData clientData
protected java.io.InputStream in
protected java.io.OutputStream out
protected java.io.BufferedReader bufferedReader
protected java.io.ObjectOutputStream o_out
protected java.io.ObjectInputStream o_in
protected java.io.BufferedInputStream b_in
protected java.io.BufferedOutputStream b_out
protected java.util.logging.Logger appLogger
protected DataMode dataModeIN
protected DataMode dataModeOUT
protected boolean communicationLogging
protected java.util.Date clientConnectedTime
protected java.util.Date lastCommunicationTime
protected boolean secure
protected static final java.lang.ThreadLocal threadEvent
protected java.lang.String maxConnectionMsg
protected final java.util.Set clientEvents
protected java.util.concurrent.ConcurrentLinkedQueue unprocessedClientEvents
protected volatile boolean closeOrLostNotified
protected final java.lang.Object lockObj
protected volatile boolean willClean
protected java.lang.String charset
protected javax.net.ssl.SSLEngine sslEngine
protected int totalReadBytes
protected int totalWrittenBytes
public BasicClientHandler(int instanceCount)
public BasicClientHandler()
public int getInstanceCount()
public void clean()
clean in interface ClientHandlerpublic void handleClient(TheClient theClient) throws java.lang.Exception
theClient.handleClient in interface ClientHandlertheClient - object that encapsulates client socket
and its configuration details.java.lang.Exceptionpublic QuickServer getServer()
getServer in interface ClientHandlersetServer(org.quickserver.net.server.QuickServer)protected void setServer(QuickServer server)
getServer()protected void setClientData(ClientData data)
ClientData,
getClientData()public ClientData getClientData()
nullgetClientData in interface ClientHandlerClientData,
setClientData(org.quickserver.net.server.ClientData)protected void setClientAuthenticationHandler(ClientAuthenticationHandler clientAuthenticationHandler)
clientAuthenticationHandler - fully qualified name of the class that
implements ClientAuthenticationHandler.protected void setAuthenticator(Authenticator authenticator)
authenticator - fully qualified name of the class that
implements Authenticator.public java.io.InputStream getInputStream()
InputStream associated with
the Client being handled.getInputStream in interface ClientHandlersetInputStream(java.io.InputStream)protected abstract void setInputStream(java.io.InputStream in)
throws java.io.IOException
InputStream associated with
the Client being handled.java.io.IOExceptiongetInputStream()public java.io.OutputStream getOutputStream()
OutputStream associated with
the Client being handled.getOutputStream in interface ClientHandlersetOutputStream(java.io.OutputStream)public void setOutputStream(java.io.OutputStream out)
throws java.io.IOException
OutputStream associated with
the Client being handled.setOutputStream in interface ClientHandlerjava.io.IOException - if ObjectOutputStream could not be created.getOutputStream()public abstract java.io.BufferedReader getBufferedReader()
BufferedReader associated with
the Client being handled. Note that this is only available under blocking mode.getBufferedReader in interface ClientHandlergetBufferedWriter()public java.io.BufferedWriter getBufferedWriter()
BufferedWriter associated with
the Client being handled.getBufferedWriter in interface ClientHandlerpublic java.io.ObjectOutputStream getObjectOutputStream()
ObjectOutputStream associated with
the Client being handled.
It will be null if no ClientObjectHandler
was set in QuickServer.getObjectOutputStream in interface ClientHandlergetObjectInputStream()public java.io.ObjectInputStream getObjectInputStream()
ObjectInputStream associated with
the Client being handled.
It will be null if no ClientObjectHandler
was set in QuickServer.getObjectInputStream in interface ClientHandlergetObjectOutputStream()protected void setClientEventHandler(ClientEventHandler handler)
protected void setClientExtendedEventHandler(ClientExtendedEventHandler handler)
protected void setClientCommandHandler(ClientCommandHandler handler)
protected void setClientObjectHandler(ClientObjectHandler handler)
handler - fully qualified name of the class that
implements ClientObjectHandlerpublic abstract void closeConnection()
closeConnection in interface ClientHandlerpublic java.net.Socket getSocket()
getSocket in interface ClientHandlerpublic void setSocket(java.net.Socket socket)
setSocket in interface ClientHandlerupdateInputOutputStreams()public boolean isConected()
throws java.net.SocketException
isConnected()isConected in interface ClientHandlerjava.net.SocketException - if Socket is not open.public boolean isConnected()
throws java.net.SocketException
isConnected in interface ClientHandlerjava.net.SocketException - if Socket is not open.public boolean isOpen()
isOpen in interface ClientHandlerpublic boolean isClosed()
isClosed in interface ClientHandlerpublic void sendClientMsg(java.lang.String msg)
throws java.io.IOException
sendClientMsg in interface ClientHandlerjava.io.IOException - if Socket IO Error or Socket was closed by the client.public void sendClientBytes(java.lang.String msg)
throws java.io.IOException
sendClientBytes in interface ClientHandlerjava.io.IOException - if Socket IO Error or Socket was closed by the client.public void sendClientObject(java.lang.Object msg)
throws java.io.IOException
sendClientObject in interface ClientHandlerjava.io.IOException - if Socket IO Error or Socket was closed
by the client.java.lang.IllegalStateException - if DataType.OUT is not in
DataMode.OBJECTsetDataMode(org.quickserver.net.server.DataMode, org.quickserver.net.server.DataType)public void sendSystemMsg(java.lang.String msg)
QuickServer.getAppLogger() with Level.INFO as its level.sendSystemMsg in interface ClientHandlerpublic void sendSystemMsg(java.lang.String msg,
java.util.logging.Level level)
QuickServer.getAppLogger().sendSystemMsg in interface ClientHandlerpublic void sendSystemMsg(java.lang.String msg,
boolean newline)
sendSystemMsg(java.lang.String),
since it uses Logging.sendSystemMsg in interface ClientHandlernewline - indicates if new line required at the end.public abstract void run()
run in interface java.lang.Runnablerun in interface ClientHandlerprotected void prepareForRun()
throws java.net.SocketException,
java.io.IOException
java.net.SocketExceptionjava.io.IOExceptionprotected void processMaxConnection(ClientEvent currentEvent) throws java.io.IOException
java.io.IOExceptionprotected AuthStatus processAuthorisation() throws java.net.SocketException, java.io.IOException, AppException
java.net.SocketExceptionjava.io.IOExceptionAppExceptionprotected void notifyCloseOrLost()
throws java.io.IOException
java.io.IOExceptionprotected void returnClientData()
protected void returnClientHandler()
public java.lang.String getName()
getName in interface ClientHandlerpublic java.lang.String info()
info in interface ClientHandlerpublic java.lang.String toString()
toString in interface ClientHandlertoString in class java.lang.Objectprotected static java.lang.String getClientIdentifiable(ClientHandler foundClientHandler)
public abstract void setDataMode(DataMode dataMode, DataType dataType) throws java.io.IOException
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.setDataMode in interface ClientHandlerdataMode - mode of data exchange - String or Object.dataType - type of data for which mode has to be set.java.io.IOException - if mode could not be changed.public DataMode getDataMode(DataType dataType)
DataMode of the ClientHandler for the
DataType.getDataMode in interface ClientHandlerpublic java.sql.Connection getConnection(java.lang.String id)
throws java.lang.Exception
getServer().getDBPoolUtil().getConnection(id)Connection object for the
DatabaseConnection that is identified by id passed. If id passed
does not match with any connection loaded by this class it will
return null.
This just calls getServer().getDBPoolUtil().getConnection(id)getConnection in interface ClientHandlerjava.lang.Exceptionpublic java.util.Date getClientConnectedTime()
nullgetClientConnectedTime in interface ClientHandlerprotected abstract byte[] readInputStream()
throws java.io.IOException
java.io.IOExceptionprotected static byte[] readInputStream(java.io.InputStream _in)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readBytes()
throws java.io.IOException
DataType.IN is in DataMode.BYTE mode.readBytes in interface ClientHandlerjava.io.IOExceptionpublic void setCommunicationLogging(boolean communicationLogging)
setCommunicationLogging in interface ClientHandlergetCommunicationLogging()public boolean getCommunicationLogging()
getCommunicationLogging in interface ClientHandlersetCommunicationLogging(boolean)public java.util.Date getLastCommunicationTime()
nullgetLastCommunicationTime in interface ClientHandlerpublic void updateLastCommunicationTime()
updateLastCommunicationTime in interface ClientHandlerpublic void forceClose()
throws java.io.IOException
forceClose in interface ClientHandlerjava.io.IOExceptionpublic boolean isSecure()
isSecure in interface ClientHandlerpublic void setSecure(boolean secure)
setSecure in interface ClientHandlersecure - public abstract void updateInputOutputStreams()
throws java.io.IOException
updateInputOutputStreams in interface ClientHandlerjava.io.IOExceptionsetSocket(java.net.Socket)public void makeSecure()
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
makeSecure(false, false, true, null).makeSecure in interface ClientHandlerjava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.KeyManagementExceptionpublic void makeSecure(java.lang.String protocol)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
makeSecure(false, false, true, protocol).makeSecure in interface ClientHandlerjava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.KeyManagementExceptionpublic void makeSecure(boolean useClientMode,
boolean needClientAuth,
boolean autoClose,
java.lang.String protocol)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
makeSecure in interface ClientHandleruseClientMode - falg if the socket should start its first handshake in "client" mode.needClientAuth - flag if the clients must authenticate themselves.autoClose - close the underlying socket when this socket is closedprotocol - the standard name of the requested protocol. If null will use the protocol set in secure configuration of the server.java.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.KeyManagementExceptionpublic void sendClientBinary(byte[] data)
throws java.io.IOException
sendClientBinary in interface ClientHandlerjava.io.IOException - if Socket IO Error or Socket was closed by the client.public void sendClientBinary(byte[] data,
int off,
int len)
throws java.io.IOException
sendClientBinary in interface ClientHandlerjava.io.IOException - if Socket IO Error or Socket was closed by the client.public byte[] readBinary()
throws java.io.IOException
DataType.IN is in DataMode.BINARY mode.readBinary in interface ClientHandlerjava.io.IOExceptionprotected void setClientBinaryHandler(ClientBinaryHandler handler)
handler - fully qualified name of the class that
implements ClientBinaryHandlerpublic java.util.logging.Logger getAppLogger()
getAppLogger in interface ClientHandlerpublic void setTimeout(int time)
setTimeout in interface ClientHandlertime - client socket timeout in milliseconds.getTimeout()public int getTimeout()
getTimeout in interface ClientHandlersetTimeout(int)public boolean hasEvent(ClientEvent event)
hasEvent in interface ClientHandlerpublic void addEvent(ClientEvent event)
addEvent in interface ClientHandlerpublic void removeEvent(ClientEvent event)
removeEvent in interface ClientHandlerprotected ClientEvent getThreadEvent()
public void setMaxConnectionMsg(java.lang.String msg)
setMaxConnectionMsg in interface ClientHandlerpublic java.lang.String getMaxConnectionMsg()
getMaxConnectionMsg in interface ClientHandlerpublic abstract boolean getBlockingMode()
public abstract void setSocketChannel(java.nio.channels.SocketChannel socketChannel)
setSocketChannel in interface ClientHandlerpublic abstract java.nio.channels.SocketChannel getSocketChannel()
getSocketChannel in interface ClientHandlerpublic abstract void setSelectionKey(java.nio.channels.SelectionKey selectionKey)
setSelectionKey in interface ClientHandlerpublic abstract java.nio.channels.SelectionKey getSelectionKey()
getSelectionKey in interface ClientHandlerpublic boolean getWillClean()
public abstract void registerForRead()
throws java.io.IOException,
java.nio.channels.ClosedChannelException
registerForRead in interface ClientHandlerjava.io.IOExceptionjava.nio.channels.ClosedChannelExceptionpublic abstract void registerForWrite()
throws java.io.IOException,
java.nio.channels.ClosedChannelException
registerForWrite in interface ClientHandlerjava.io.IOExceptionjava.nio.channels.ClosedChannelExceptionprotected abstract void setClientWriteHandler(ClientWriteHandler handler)
handler - fully qualified name of the class that
implements ClientWriteHandlerpublic void setCharset(java.lang.String charset)
setCharset in interface ClientHandlercharset - to be used for String decoding and encodinggetCharset()public java.lang.String getCharset()
getCharset in interface ClientHandlersetCharset(java.lang.String)public java.lang.String getHostAddress()
getHostAddress in interface ClientHandlerprotected void assertionSystemExit()
public boolean isClientEventNext(ClientEvent clientEvent)
isClientEventNext in interface ClientHandlerpublic java.io.BufferedInputStream getBufferedInputStream()
BufferedInputStream associated with
the Client being handled. Can be null if not available at the time of method call.getBufferedInputStream in interface ClientHandlergetBufferedOutputStream()public java.io.BufferedOutputStream getBufferedOutputStream()
BufferedOutputStream associated with
the Client being handled. Can be null if not available at the time of method call.getBufferedOutputStream in interface ClientHandlergetBufferedInputStream()protected void handleTimeout(java.net.SocketTimeoutException e)
throws java.net.SocketException,
java.io.IOException
java.net.SocketExceptionjava.io.IOExceptionpublic javax.net.ssl.SSLEngine getSSLEngine()
public int getTotalReadBytes()
getTotalReadBytes in interface ClientHandlerpublic int getTotalWrittenBytes()
getTotalWrittenBytes in interface ClientHandlerpublic void resetTotalReadBytes()
resetTotalReadBytes in interface ClientHandlerpublic void resetTotalWrittenBytes()
resetTotalWrittenBytes in interface ClientHandlerCopyright © 2003-2014 QuickServer.org