com.faunos.util.net.http
Class HttpServer

java.lang.Object
  extended by com.faunos.util.net.HandletServer
      extended by 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

Field Summary
protected  ResponseFactory app
           
 
Fields inherited from class com.faunos.util.net.HandletServer
logger
 
Constructor Summary
HttpServer(ResponseFactory app, InetAddress host, int port, ExecutorService exec)
          Constructs an application-specific instance.
HttpServer(ResponseFactory app, InetAddress host, int port, ExecutorService exec, Logger logger)
          Constructs an application-specific instance.
 
Method Summary
protected  Handlet newHandlet()
          Returns a protocol-specific handlet.
 
Methods inherited from class com.faunos.util.net.HandletServer
inputChannel, isAlive, outputChannel, setProcessingHintThreshold, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

app

protected final ResponseFactory app
Constructor Detail

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)
Method Detail

newHandlet

protected Handlet newHandlet()
Description copied from class: HandletServer
Returns a protocol-specific handlet.

Specified by:
newHandlet in class HandletServer
Returns:
a new HttpHandlet


SourceForge.net Logo