Java Doc for ClientHandler.java in  » Net » QuickServer » org » quickserver » net » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » QuickServer » org.quickserver.net.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.quickserver.net.server.ClientHandler

All known Subclasses:   org.quickserver.net.server.impl.BasicClientHandler,
ClientHandler
public interface ClientHandler extends Runnable(Code)
Interface that represents client handle in QuickServer.

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) based on its implementation.


author:
   Akshathkumar Shetty




Method Summary
 voidaddEvent(ClientEvent event)
     Adds the ClientEvent.
 voidclean()
    
 voidcloseConnection()
     Closes client socket associated.
 voidforceClose()
     Force the closing of the client by closing the associated socket.
 LoggergetAppLogger()
     Returns client SelectionKey associated, if any.
 BufferedInputStreamgetBufferedInputStream()
     Returns the java.io.BufferedInputStream associated with the Client being handled.
 BufferedOutputStreamgetBufferedOutputStream()
     Returns the java.io.BufferedOutputStream associated with the Client being handled.
 BufferedReadergetBufferedReader()
     Returns the java.io.BufferedReader associated with the Client being handled.
 BufferedWritergetBufferedWriter()
     Returns the java.io.BufferedWriter associated with the Client being handled.
 StringgetCharset()
     Returns Charset to be used for String decoding and encoding..
 DategetClientConnectedTime()
     Returns the date/time when the client socket was assigned to this ClientHanlder.
 ClientDatagetClientData()
    
 booleangetCommunicationLogging()
     Returns the communication logging flag.
 ConnectiongetConnection(String id)
     Returns the java.sql.Connection object for the DatabaseConnection that is identified by id passed.
 DataModegetDataMode(DataType dataType)
     Returns the DataMode of the ClientHandler for the DataType.
 StringgetHostAddress()
     Returns cached socket host ip address.
 InputStreamgetInputStream()
     Returns the java.io.InputStream associated with the Client being handled.
 DategetLastCommunicationTime()
     Returns the date/time when the client socket last sent a data to this ClientHanlder.
 StringgetMaxConnectionMsg()
     Returns message to be displayed to the client when maximum connection reaches.
 StringgetName()
    
 ObjectInputStreamgetObjectInputStream()
     Returns the java.io.ObjectInputStream associated with the Client being handled.
 ObjectOutputStreamgetObjectOutputStream()
     Returns the java.io.ObjectOutputStream associated with the Client being handled.
 OutputStreamgetOutputStream()
     Returns the java.io.OutputStream associated with the Client being handled.
 SelectionKeygetSelectionKey()
     Returns client SelectionKey associated, if any.
 QuickServergetServer()
     Returns the QuickServer object that created it.
 SocketgetSocket()
     Returns client socket associated.
 SocketChannelgetSocketChannel()
     Returns client socket channel associated, if any.
 intgetTimeout()
     Returns the Client socket timeout in milliseconds.
 voidhandleClient(TheClient theClient)
     Associates the ClientHanlder with the client encapsulated by theClient.
 booleanhasEvent(ClientEvent event)
     Checks if this client has the event.
 Stringinfo()
     Returns the ClientHandler detailed information.
 booleanisClientEventNext(ClientEvent clientEvent)
     Checks if the passed ClientEvent is the one next for processing if a thread is allowed through this object.
 booleanisClosed()
     Checks if the client is closed.
 booleanisConected()
     Checks if the client is still connected.
 booleanisConnected()
     Checks if the client is still connected.
 booleanisOpen()
     Checks if the client is still connected and if socket is open.
 booleanisSecure()
     Returns flag indicating if the client is connected in secure mode (SSL or TLS).
 voidmakeSecure()
     Makes current Client connection to secure protocol based on the secure configuration set to the server.
 voidmakeSecure(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.
 voidmakeSecure(String protocol)
     Makes current Client connection to secure protocol.
 byte[]readBinary()
     Read the binary input.
 StringreadBytes()
     Read the byte input.
 voidregisterForRead()
     Register OP_READ with the SelectionKey associated with the channel.
 voidregisterForWrite()
     Register OP_WRITE with the SelectionKey associated with the channel.
 voidremoveEvent(ClientEvent event)
     Removes the ClientEvent.
 voidrun()
    
 voidsendClientBinary(byte[] data)
     Send a binary data to the connected client.
 voidsendClientBinary(byte[] data, int off, int len)
     Send a binary data to the connected client.
 voidsendClientBytes(String msg)
     Send a String message to the connected client as a string of bytes.
 voidsendClientMsg(String msg)
     Send a String message to the connected client it adds a new line{\r\n} to the end of the string.
 voidsendClientObject(Object msg)
     Send a Object message to the connected client.
 voidsendSystemMsg(String msg)
     Send a String message to the logger associated with QuickServer.getAppLogger with Level.INFO as its level.
 voidsendSystemMsg(String msg, Level level)
     Send a String message to the logger associated with QuickServer.getAppLogger .
 voidsendSystemMsg(String msg, boolean newline)
     Send a String message to the system output stream.
 voidsetCharset(String charset)
     Sets the Charset to be used for String decoding and encoding.
 voidsetCommunicationLogging(boolean communicationLogging)
     Sets the communication logging flag.
 voidsetDataMode(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.
 voidsetMaxConnectionMsg(String msg)
     Sets message to be displayed when maximum connection reaches.
 voidsetOutputStream(OutputStream out)
     Set the java.io.OutputStream associated with the Client being handled.
 voidsetSecure(boolean secure)
     Sets flag indicating if the client is connected in secure mode (SSL or TLS).
 voidsetSelectionKey(SelectionKey selectionKey)
     Sets client SelectionKey associated, if any.
 voidsetSocket(Socket socket)
     Returns client socket associated.
 voidsetSocketChannel(SocketChannel socketChannel)
     Sets client socket channel associated, if any.
 voidsetTimeout(int time)
     Sets the client socket's timeout.
 StringtoString()
     Returns the ClientHandler information.
 voidupdateInputOutputStreams()
     Updates the InputStream and OutputStream for the ClientHandler for the set Socket.
 voidupdateLastCommunicationTime()
    



Method Detail
addEvent
void addEvent(ClientEvent event)(Code)
Adds the ClientEvent.
since:
   1.4.5



clean
void clean()(Code)



closeConnection
void closeConnection()(Code)
Closes client socket associated.



forceClose
void forceClose() throws IOException(Code)
Force the closing of the client by closing the associated socket.
since:
   1.3.3



getAppLogger
Logger getAppLogger()(Code)
Returns client SelectionKey associated, if any.
since:
   1.4.5



getBufferedInputStream
BufferedInputStream getBufferedInputStream()(Code)
Returns the java.io.BufferedInputStream associated with the Client being handled. Can be null if not available at the time of method call.
See Also:   ClientHandler.getBufferedOutputStream
since:
   1.4.6



getBufferedOutputStream
BufferedOutputStream getBufferedOutputStream()(Code)
Returns the java.io.BufferedOutputStream associated with the Client being handled. Can be null if not available at the time of method call.
See Also:   ClientHandler.getBufferedInputStream
since:
   1.4.6



getBufferedReader
BufferedReader getBufferedReader()(Code)
Returns the java.io.BufferedReader associated with the Client being handled. Note that this is only available under blocking mode.
See Also:   ClientHandler.getBufferedWriter



getBufferedWriter
BufferedWriter getBufferedWriter()(Code)
Returns the java.io.BufferedWriter associated with the Client being handled.



getCharset
String getCharset()(Code)
Returns Charset to be used for String decoding and encoding..
See Also:   ClientHandler.setCharset
since:
   1.4.5



getClientConnectedTime
Date getClientConnectedTime()(Code)
Returns the date/time when the client socket was assigned to this ClientHanlder. If no client is currently connected it will return null
since:
   1.3.1



getClientData
ClientData getClientData()(Code)
Returns the ClientData object associated with this ClientHandler, if not set will return null
See Also:   ClientData



getCommunicationLogging
boolean getCommunicationLogging()(Code)
Returns the communication logging flag.
See Also:   ClientHandler.setCommunicationLogging
since:
   1.3.2



getConnection
Connection getConnection(String id) throws Exception(Code)
Returns the java.sql.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)
since:
   1.3



getDataMode
DataMode getDataMode(DataType dataType)(Code)
Returns the DataMode of the ClientHandler for the DataType.
since:
   1.2



getHostAddress
String getHostAddress()(Code)
Returns cached socket host ip address.
since:
   1.4.5



getInputStream
InputStream getInputStream()(Code)
Returns the java.io.InputStream associated with the Client being handled.



getLastCommunicationTime
Date getLastCommunicationTime()(Code)
Returns the date/time when the client socket last sent a data to this ClientHanlder. If no client is currently connected it will return null
since:
   1.3.3



getMaxConnectionMsg
String getMaxConnectionMsg()(Code)
Returns message to be displayed to the client when maximum connection reaches.
since:
   1.4.5



getName
String getName()(Code)
Returns the ClientHandler name
since:
   1.4.6



getObjectInputStream
ObjectInputStream getObjectInputStream()(Code)
Returns the java.io.ObjectInputStream associated with the Client being handled. It will be null if no ClientObjectHandler was set in QuickServer .
See Also:   ClientHandler.getObjectOutputStream
since:
   1.2



getObjectOutputStream
ObjectOutputStream getObjectOutputStream()(Code)
Returns the java.io.ObjectOutputStream associated with the Client being handled. It will be null if no ClientObjectHandler was set in QuickServer .
See Also:   ClientHandler.getObjectInputStream
since:
   1.2



getOutputStream
OutputStream getOutputStream()(Code)
Returns the java.io.OutputStream associated with the Client being handled.
See Also:   ClientHandler.setOutputStream



getSelectionKey
SelectionKey getSelectionKey()(Code)
Returns client SelectionKey associated, if any.
since:
   1.4.5



getServer
QuickServer getServer()(Code)
Returns the QuickServer object that created it.



getSocket
Socket getSocket()(Code)
Returns client socket associated.



getSocketChannel
SocketChannel getSocketChannel()(Code)
Returns client socket channel associated, if any.
since:
   1.4.5



getTimeout
int getTimeout()(Code)
Returns the Client socket timeout in milliseconds.
See Also:   ClientHandler.setTimeout
since:
   1.4.5



handleClient
void handleClient(TheClient theClient)(Code)
Associates the ClientHanlder with the client encapsulated by theClient.
Parameters:
  theClient - object that encapsulates client socket and its configuration details.



hasEvent
boolean hasEvent(ClientEvent event)(Code)
Checks if this client has the event.
since:
   1.4.5



info
String info()(Code)
Returns the ClientHandler detailed information. If ClientData is present and is ClientIdentifiable will return ClientInfo else it will return Clients InetAddress and port information.



isClientEventNext
boolean isClientEventNext(ClientEvent clientEvent)(Code)
Checks if the passed ClientEvent is the one next for processing if a thread is allowed through this object.
since:
   1.4.6



isClosed
boolean isClosed()(Code)
Checks if the client is closed.
since:
   1.4.1



isConected
boolean isConected() throws SocketException(Code)
Checks if the client is still connected.
exception:
  SocketException - if Socket is not open.ClientHandler.isConnected



isConnected
boolean isConnected() throws SocketException(Code)
Checks if the client is still connected.
exception:
  SocketException - if Socket is not open.
since:
   1.4.5



isOpen
boolean isOpen()(Code)
Checks if the client is still connected and if socket is open. This is same as isConnected() but does not throw SocketException.
since:
   1.4.6



isSecure
boolean isSecure()(Code)
Returns flag indicating if the client is connected in secure mode (SSL or TLS). secure flag
since:
   1.4.0



makeSecure
void makeSecure() throws IOException, NoSuchAlgorithmException, KeyManagementException(Code)
Makes current Client connection to secure protocol based on the secure configuration set to the server. This method will just call makeSecure(false, false, true, null).
throws:
  IOException -
throws:
  NoSuchAlgorithmException -
throws:
  KeyManagementException -
since:
   1.4.0



makeSecure
void makeSecure(boolean useClientMode, boolean needClientAuth, boolean autoClose, String protocol) throws IOException, NoSuchAlgorithmException, KeyManagementException(Code)
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. If null will use the protocol set in secure configuration of the server.
throws:
  IOException -
throws:
  NoSuchAlgorithmException -
throws:
  KeyManagementException -
since:
   1.4.0



makeSecure
void makeSecure(String protocol) throws IOException, NoSuchAlgorithmException, KeyManagementException(Code)
Makes current Client connection to secure protocol. This method will just call makeSecure(false, false, true, protocol).
throws:
  IOException -
throws:
  NoSuchAlgorithmException -
throws:
  KeyManagementException -
since:
   1.4.0



readBinary
byte[] readBinary() throws IOException(Code)
Read the binary input. This will block till some data is received from the stream. Allowed only when DataType.IN is in DataMode.BINARY mode. The data as a String
since:
   1.4



readBytes
String readBytes() throws IOException(Code)
Read the byte input. This will block till some data is received from the stream. Allowed only when DataType.IN is in DataMode.BYTE mode. The data as a String
since:
   1.3.2



registerForRead
void registerForRead() throws IOException, ClosedChannelException(Code)
Register OP_READ with the SelectionKey associated with the channel. If SelectionKey is not set then it registers the channel with the Selector.
since:
   1.4.5



registerForWrite
void registerForWrite() throws IOException, ClosedChannelException(Code)
Register OP_WRITE with the SelectionKey associated with the channel.
since:
   1.4.5



removeEvent
void removeEvent(ClientEvent event)(Code)
Removes the ClientEvent.
since:
   1.4.5



run
void run()(Code)



sendClientBinary
void sendClientBinary(byte[] data) throws IOException(Code)
Send a binary data to the connected client. If client is not connected it will just return.
since:
   1.4
exception:
  IOException - if Socket IO Error or Socket was closed by the client.



sendClientBinary
void sendClientBinary(byte[] data, int off, int len) throws IOException(Code)
Send a binary data to the connected client. If client is not connected it will just return.
since:
   1.4.5
exception:
  IOException - if Socket IO Error or Socket was closed by the client.



sendClientBytes
void sendClientBytes(String msg) throws IOException(Code)
Send a String message to the connected client as a string of bytes. If client is not connected it will just return.
since:
   1.3.1
exception:
  IOException - if Socket IO Error or Socket was closed by the client.



sendClientMsg
void sendClientMsg(String msg) throws IOException(Code)
Send a String message to the connected client it adds a new line{\r\n} to the end of the string. If client is not connected it will just return.
exception:
  IOException - if Socket IO Error or Socket was closed by the client.



sendClientObject
void sendClientObject(Object msg) throws IOException(Code)
Send a Object message to the connected client. The message Object passed must be serializable. If client is not connected it will just return.
exception:
  IOException - if Socket IO Error or Socket was closed by the client.
exception:
  IllegalStateException - if DataType.OUT is not in DataMode.OBJECT
See Also:   ClientHandler.setDataMode
since:
   1.2



sendSystemMsg
void sendSystemMsg(String msg)(Code)
Send a String message to the logger associated with QuickServer.getAppLogger with Level.INFO as its level.



sendSystemMsg
void sendSystemMsg(String msg, Level level)(Code)
Send a String message to the logger associated with QuickServer.getAppLogger .
since:
   1.2



sendSystemMsg
void sendSystemMsg(String msg, boolean newline)(Code)
Send a String message to the system output stream.
Parameters:
  newline - indicates if new line required at the end.ClientHandler.sendSystemMsg(java.lang.String)



setCharset
void setCharset(String charset)(Code)
Sets the Charset to be used for String decoding and encoding.
Parameters:
  charset - to be used for String decoding and encoding
See Also:   ClientHandler.getCharset
since:
   1.4.5



setCommunicationLogging
void setCommunicationLogging(boolean communicationLogging)(Code)
Sets the communication logging flag.
See Also:   ClientHandler.getCommunicationLogging
since:
   1.3.2



setDataMode
void setDataMode(DataMode dataMode, DataType dataType) throws IOException(Code)
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.
since:
   1.2
exception:
  IOException - if mode could not be changed.
Parameters:
  dataMode - mode of data exchange - String or Object.
Parameters:
  dataType - type of data for which mode has to be set.



setMaxConnectionMsg
void setMaxConnectionMsg(String msg)(Code)
Sets message to be displayed when maximum connection reaches.
since:
   1.4.5



setOutputStream
void setOutputStream(OutputStream out) throws IOException(Code)
Set the java.io.OutputStream associated with the Client being handled.
since:
   1.1
See Also:   ClientHandler.getOutputStream
exception:
  IOException - if ObjectOutputStream could not be created.



setSecure
void setSecure(boolean secure)(Code)
Sets flag indicating if the client is connected in secure mode (SSL or TLS).
Parameters:
  secure -
since:
   1.4.0



setSelectionKey
void setSelectionKey(SelectionKey selectionKey)(Code)
Sets client SelectionKey associated, if any.
since:
   1.4.5



setSocket
void setSocket(Socket socket)(Code)
Returns client socket associated.
since:
   1.4.0
See Also:   ClientHandler.updateInputOutputStreams



setSocketChannel
void setSocketChannel(SocketChannel socketChannel)(Code)
Sets client socket channel associated, if any.
since:
   1.4.5



setTimeout
void setTimeout(int time)(Code)
Sets the client socket's timeout.
Parameters:
  time - client socket timeout in milliseconds.
See Also:   ClientHandler.getTimeout
since:
   1.4.5



toString
String toString()(Code)
Returns the ClientHandler information. If ClientData is present and is ClientIdentifiable will return ClientInfo else it will return Clients InetAddress and port information.



updateInputOutputStreams
void updateInputOutputStreams() throws IOException(Code)
Updates the InputStream and OutputStream for the ClientHandler for the set Socket.
since:
   1.4.0
See Also:   ClientHandler.setSocket



updateLastCommunicationTime
void updateLastCommunicationTime()(Code)
Updates the last communication time for this client
since:
   1.3.3



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.