public abstract class ThreadedHttpServer extends Object implements Runnable
Modifier and Type | Class and Description |
---|---|
class |
ThreadedHttpServer.Request
Inner class for handling a single HTTP server request.
|
Modifier and Type | Field and Description |
---|---|
protected ServerSocket |
ss |
Constructor and Description |
---|
ThreadedHttpServer() |
ThreadedHttpServer(ServerSocket ss)
Constructs a new SingleHttpServer, initialized with a server socket.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes as soon as possible.
|
protected void |
exception(Exception e)
Called when an exception occurs when listening; does nothing now.
|
int |
getPort() |
protected abstract void |
handleRequest(ThreadedHttpServer.Request request)
Override this method to handle the request.
|
void |
run() |
void |
start()
Starts listening in a new thread.
|
String |
toString()
Returns a debug string.
|
protected final ServerSocket ss
public ThreadedHttpServer(ServerSocket ss)
ss
- server socket to listen withpublic ThreadedHttpServer() throws IOException
IOException
public void start()
public int getPort()
protected abstract void handleRequest(ThreadedHttpServer.Request request) throws IOException
s
- server requestaddress
- address of requestIOException
protected void exception(Exception e)
public void close() throws IOException
IOException
Copyright © 2013. All Rights Reserved.