| This interface defines the methods
that should be implemented by any class that
wants to handle java Objects from a client.
Recommendations to be followed when implementing ClientObjectHandler
- Should have a default constructor.
- Should be thread safe.
- It should not store any client data that may be needed in the
implementation.
- If any client data is need to be saved from the client session,
it should be saved to a
ClientData class, which can be retrieved
using handler.getClientData() method.
Ex:
package dateserver;
import java.net.*;
import java.io.*;
import java.util.Date;
import org.quickserver.net.server.*;
public class ObjectHandler implements ClientObjectHandler {
public void handleObject(ClientHandler handler, Object command)
throws SocketTimeoutException, IOException {
handler.sendSystemMsg("Got Object : " + command.toString());
handler.setDataMode(DataMode.STRING);
}
}
author: Akshathkumar Shetty |