de.unkrig.commons.net.http
Class HttpServer

java.lang.Object
  extended by de.unkrig.commons.net.http.HttpServer
All Implemented Interfaces:
RunnableWhichThrows<java.io.IOException>, Stoppable

public final class HttpServer
extends java.lang.Object
implements RunnableWhichThrows<java.io.IOException>, Stoppable

Implementation of an HTTP server.

See Also:
HttpServer(InetSocketAddress, HttpClientConnectionHandler)

Constructor Summary
HttpServer(java.net.InetSocketAddress endpoint, HttpClientConnectionHandler httpClientConnectionHandler)
          Accepts connections on the endpoint; obtains a new Servlett from the httpClientConnectionHandlerFactory for each accepted connection, and then calls Servlett.handleRequest(HttpRequest) for each received request.
 
Method Summary
 java.net.InetSocketAddress getEndpointAddress()
           
 void run()
          "To run" an instance means to call this method and wait until it returns.
 void stop()
          Returns when this Stoppable has completely stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServer

public HttpServer(java.net.InetSocketAddress endpoint,
                  HttpClientConnectionHandler httpClientConnectionHandler)
           throws java.io.IOException
Accepts connections on the endpoint; obtains a new Servlett from the httpClientConnectionHandlerFactory for each accepted connection, and then calls Servlett.handleRequest(HttpRequest) for each received request.

Throws:
java.io.IOException
Method Detail

run

public void run()
         throws java.io.IOException
Description copied from interface: RunnableWhichThrows
"To run" an instance means to call this method and wait until it returns.

Specified by:
run in interface RunnableWhichThrows<java.io.IOException>
Throws:
java.io.IOException

stop

public void stop()
Description copied from interface: Stoppable
Returns when this Stoppable has completely stopped.

Specified by:
stop in interface Stoppable

getEndpointAddress

public java.net.InetSocketAddress getEndpointAddress()
Returns:
The endpoint address of this HTTP server
See Also:
TcpServer.getEndpointAddress()