public class HttpServer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpServer.Factory |
| Modifier and Type | Field and Description |
|---|---|
NioSelectorScheduler |
nio |
| Constructor and Description |
|---|
HttpServer() |
HttpServer(int port,
java.lang.Class<? extends HttpSession> httpSessionClass)
Creates a separate thread and a selector for the select loop and calls
#listen(int, Class)listen |
HttpServer(int port,
HttpSession.StringRouter handler) |
HttpServer(int port,
NioSelectorScheduler.SessionFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
listen(int port,
java.lang.Class<? extends HttpSession> httpSessionClass,
Scheduler httpSessionScheduler)
Sets up a listener on the supplied port, and when a fresh connection comes in, it creates
a new instance of the httpSessionClass task and exceutes it on the supplied scheduler.
|
void |
listen(int port,
NioSelectorScheduler.SessionFactory factory,
Scheduler httpSessionScheduler) |
public NioSelectorScheduler nio
public HttpServer()
public HttpServer(int port,
java.lang.Class<? extends HttpSession> httpSessionClass)
throws java.io.IOException
#listen(int, Class)listenport. - Port to listen for http connections.httpSessionClass - An instance of the supplied class is created and bound to the
incoming socket connection, and the task is scheduled for execution on the default scheduler.java.io.IOExceptionpublic HttpServer(int port,
NioSelectorScheduler.SessionFactory factory)
throws java.io.IOException
java.io.IOExceptionpublic HttpServer(int port,
HttpSession.StringRouter handler)
throws java.io.IOException
java.io.IOExceptionpublic void listen(int port,
java.lang.Class<? extends HttpSession> httpSessionClass,
Scheduler httpSessionScheduler)
throws java.io.IOException
port. - Port to listen for http connections.httpSessionClass - class of task to instantiation on incoming connectionhttpSessionScheduler - the scheduler on which to schedule the http session task.java.io.IOExceptionpublic void listen(int port,
NioSelectorScheduler.SessionFactory factory,
Scheduler httpSessionScheduler)
throws java.io.IOException
java.io.IOException