| java.lang.Object echo2example.chatserver.Server
Server | public class Server (Code) | | A representation of the state of the chat engine.
This object is the main entry-point for the servlet
to update and query the state of the chat room.
|
Constructor Summary | |
public | Server() Creates a new Server . |
Server | public Server()(Code) | | Creates a new Server .
|
addUser | public String addUser(String userName, String remoteHost)(Code) | | Adds a user.
Parameters: userName - the user name Parameters: remoteHost - the remote host requesting the operation an authentication token if the user was successfully added ornull if it was not (e.g., due to the name already being in use) |
getMessages | public Message[] getMessages(long lastRetrievedId)(Code) | | Retrieves all messages with ids greater than the specified id.
Parameters: lastRetrievedId - the id of the last message retrieved an array containing messages posted after the message identified |
getRecentMessages | public Message[] getRecentMessages()(Code) | | Returns an array of recently posted messages.
This method is queried by clients that have just joined the chat room
to retrieve context on the chat.
the recently posted messages |
postMessage | public boolean postMessage(String userName, String authToken, String remoteHost, String messageContent)(Code) | | Posts a message.
Parameters: userName - the name of the posting user Parameters: authToken - the authentication token provided to the postinguser when s/he was authenticated Parameters: remoteHost - the remote host requesting the operation Parameters: messageContent - the content of the message to post true if the message was successfully posted |
removeUser | public boolean removeUser(String userName, String authToken, String remoteHost)(Code) | | Removes a user from the chat room.
Parameters: userName - the name of the user Parameters: authToken - the authentication token provided to theuser when s/he was authenticated Parameters: remoteHost - the remote host requesting the operation true if the user was successfully removed |
|
|