csli.util.socket
Class BasicHttpServer
java.lang.Object
java.lang.Thread
csli.util.socket.BasicHttpServer
- All Implemented Interfaces:
- Runnable
public class BasicHttpServer
- extends Thread
A very basic HTTP server which is it's own thread that listens to a socket on a specified port and sends requests to
specified request handler. It subclasses thread, so all the usual mechanisms for changing priority, restarting, etc.
are available.
|
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
logger
protected static org.apache.log4j.Logger logger
BasicHttpServer
public BasicHttpServer()
getRequestHandler
public BasicHttpServer.HttpRequestHandler getRequestHandler()
- Get the currently set request handler.
- Returns:
getServerPort
public int getServerPort()
- Get the currently set port on which the server is accepting connections.
- Returns:
getWebRootDir
public File getWebRootDir()
- Get the directory where web content is located.
- Returns:
- a directory as a File object
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
setRequestHandler
public void setRequestHandler(BasicHttpServer.HttpRequestHandler requestHandler)
- Set the class which should be used as the request handler -- takes effect on the next accepted connection.
- Parameters:
requestHandler -
setServerPort
public void setServerPort(int port)
- Set the port on which the server will run -- takes effect only after the server has been restarted.
- Parameters:
port -