Package net.sf.freecol.server.control
Class UserConnectionHandler
- java.lang.Object
-
- net.sf.freecol.server.control.FreeColServerHolder
-
- net.sf.freecol.server.control.UserConnectionHandler
-
- All Implemented Interfaces:
MessageHandler
public final class UserConnectionHandler extends FreeColServerHolder implements MessageHandler
Message handler for new client connections.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
-
Constructor Summary
Constructors Constructor Description UserConnectionHandler(FreeColServer freeColServer)
Build a new user connection handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Message
handle(Connection connection, Message message)
Handle an incoming message.Message
read(Connection connection)
Read an incoming Message.-
Methods inherited from class net.sf.freecol.server.control.FreeColServerHolder
getFreeColServer, getGame
-
-
-
-
Constructor Detail
-
UserConnectionHandler
public UserConnectionHandler(FreeColServer freeColServer)
Build a new user connection handler.- Parameters:
freeColServer
- The main server object.
-
-
Method Detail
-
handle
public Message handle(Connection connection, Message message) throws FreeColException
Handle an incoming message.- Specified by:
handle
in interfaceMessageHandler
- Parameters:
connection
- TheConnection
the message arrived on.message
- TheMessage
to handle.- Returns:
- A reply message, if any.
- Throws:
FreeColException
- if the message is malformed.
-
read
public Message read(Connection connection) throws FreeColException, javax.xml.stream.XMLStreamException
Read an incoming Message.- Specified by:
read
in interfaceMessageHandler
- Parameters:
connection
- TheConnection
to read from.- Returns:
- The
Message
found, or null if none. - Throws:
FreeColException
- if the message can not be instantiated.javax.xml.stream.XMLStreamException
- if there is a problem reading the message.
-
-