|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.noderunner.http.ThreadedHttpServer
public abstract class ThreadedHttpServer
This class is for unit testing. It accepts one request at a time in a single thread. Override the handleRequest method to do something interesting.
Nested Class Summary | |
---|---|
class |
ThreadedHttpServer.Request
Inner class for handling a single HTTP server request. |
Field Summary | |
---|---|
protected ServerSocket |
ss
|
Constructor Summary | |
---|---|
ThreadedHttpServer()
|
|
ThreadedHttpServer(ServerSocket ss)
Constructs a new SingleHttpServer, initialized with a server socket. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final ServerSocket ss
Constructor Detail |
---|
public ThreadedHttpServer(ServerSocket ss)
ss
- server socket to listen withpublic ThreadedHttpServer() throws IOException
IOException
Method Detail |
---|
public void start()
public int getPort()
protected abstract void handleRequest(ThreadedHttpServer.Request request) throws IOException
s
- server requestaddress
- address of request
IOException
protected void exception(Exception e)
public final void run()
run
in interface Runnable
public void close() throws IOException
IOException
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |