ar.com.ktulu.dict
Class ServerThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--ar.com.ktulu.dict.ServerThread
All Implemented Interfaces:
java.lang.Runnable

public class ServerThread
extends java.lang.Thread

Attends one connection with a client. This is the class that has all the knowledge on how to satisfy client requests.

Author:
Luis Parravicini

Field Summary
static java.lang.String CRLF
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerThread(Server server, java.net.Socket s)
           
 
Method Summary
protected  CommandData[] getCommands()
          Reads input from the connection and parses it
 Server getServer()
           
protected  void initCommands()
           
 boolean isMimeEnabled()
           
 void println()
           
 void println(java.lang.Object x)
           
 void println(java.lang.String x)
           
protected  void processCommand(CommandData cmd)
          Dispatch to the methods that implement the service requested.
protected  java.lang.String readInputLine()
          Reads a command from the client.
 void run()
          Main loop
protected  void sendBanner(java.io.PrintWriter out)
          Welcome banner
 void setMimeEnabled(boolean enabled)
           
 void stopServer()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CRLF

public static final java.lang.String CRLF
See Also:
Constant Field Values
Constructor Detail

ServerThread

public ServerThread(Server server,
                    java.net.Socket s)
Method Detail

initCommands

protected void initCommands()

isMimeEnabled

public boolean isMimeEnabled()

setMimeEnabled

public void setMimeEnabled(boolean enabled)

sendBanner

protected void sendBanner(java.io.PrintWriter out)
Welcome banner


getServer

public Server getServer()

println

public void println()

println

public void println(java.lang.String x)

println

public void println(java.lang.Object x)

readInputLine

protected java.lang.String readInputLine()
                                  throws java.io.IOException
Reads a command from the client. The maximum length accepted is 1024.

java.io.IOException

getCommands

protected CommandData[] getCommands()
                             throws java.io.IOException
Reads input from the connection and parses it

java.io.IOException

processCommand

protected void processCommand(CommandData cmd)
Dispatch to the methods that implement the service requested.


stopServer

public void stopServer()

run

public void run()
Main loop

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread