|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ChatRoomProtocol
A Server-Client Protocol for a ChatRoom.
Field Summary | |
static int |
CHAT_ROOM_MESSAGE
|
static int |
REQUESTING_CONNECTION
|
static int |
SEND_USER_NAME
|
static int |
USER_DISCONNECTING
|
static int |
USER_NAME
|
static int |
WELCOME_MESSAGE
|
Method Summary | |
java.lang.String |
createChatMessage(java.lang.String message)
Creates a regular chat message in the form of: ID |
java.lang.String |
createConnectionRequest()
Creates a connection Message for a chat room client to send to it's server |
java.lang.String |
createDisconnectionRequest(java.lang.String userName)
Creates a chat client disconnection request message. |
java.lang.String |
createUserNameResponse(java.lang.String userName)
Creates a chat User-Name response message. |
static ChatRoomProtocol |
getInstance()
Used to access the single protocol instance |
void |
handleClientMessage(java.lang.String message,
ChatRoomConnection connection)
Handles a message received from the client on a given chat room connection. |
void |
handleServerMessage(java.lang.String message,
ChatRoomClient client)
Handles a message received from the server to a given client. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int REQUESTING_CONNECTION
public static final int SEND_USER_NAME
public static final int USER_NAME
public static final int USER_DISCONNECTING
public static final int CHAT_ROOM_MESSAGE
public static final int WELCOME_MESSAGE
Method Detail |
public static ChatRoomProtocol getInstance()
public java.lang.String createConnectionRequest()
public java.lang.String createDisconnectionRequest(java.lang.String userName)
public java.lang.String createUserNameResponse(java.lang.String userName)
userName
- the user name
public java.lang.String createChatMessage(java.lang.String message)
message
- the content of the message
public void handleClientMessage(java.lang.String message, ChatRoomConnection connection) throws java.io.IOException
message
- the client's message.connection
- the ChatRoomConnection of that client.
java.io.IOException
public void handleServerMessage(java.lang.String message, ChatRoomClient client) throws java.io.IOException, java.net.ProtocolException
message
- the server's messageclient
- the ChatRoomClient to communicate with.
java.io.IOException
java.net.ProtocolException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |