com.faunos.util.net.http
Class HttpServer
java.lang.Object
com.faunos.util.net.HandletServer
com.faunos.util.net.http.HttpServer
- Direct Known Subclasses:
- Caroon, DebugHttpServer
public class HttpServer
- extends HandletServer
An embedded, non-blocking HTTP server implementation using a staged I/O
approach.
Implementation Notes
This implementation uses a single thread to perform all non-blocking I/O.
In order to achieve this, every socket-specific [non-blocking] I/O operation
is performed through an inversion-of-control interface called
Handlet
. The Handlet interface is not protocol-specific;
the HTTP-specific implementation is HttpHandlet
. HttpHandlet
is itself internally structured around a stack of
stages representing an inversion-of-control analog of a
function call-stack.
- Author:
- Babak Farhang
- See Also:
ResponseFactory
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
app
protected final ResponseFactory app
HttpServer
public HttpServer(ResponseFactory app,
InetAddress host,
int port,
ExecutorService exec)
throws IOException
- Constructs an application-specific instance.
- Parameters:
app
- the app-specific factory used to serve content.
- Throws:
IOException
HttpServer
public HttpServer(ResponseFactory app,
InetAddress host,
int port,
ExecutorService exec,
Logger logger)
throws IOException
- Constructs an application-specific instance.
- Parameters:
app
- the app-specific factory used to serve content
- Throws:
IOException
- See Also:
HandletServer.HandletServer(InetAddress, int, ExecutorService, Logger)
newHandlet
protected Handlet newHandlet()
- Description copied from class:
HandletServer
- Returns a protocol-specific handlet.
- Specified by:
newHandlet
in class HandletServer
- Returns:
- a new
HttpHandlet