Package gnu.kawa.servlet
Class KawaHttpHandler
- java.lang.Object
-
- gnu.kawa.servlet.KawaHttpHandler
-
- All Implemented Interfaces:
HttpHandler
public class KawaHttpHandler extends Object implements HttpHandler
Web server support glue built on JDK 6's built-in HttpServer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KawaHttpHandler.Context
static class
KawaHttpHandler.StaticFileHandler
-
Field Summary
Fields Modifier and Type Field Description static int
serverBacklog
static HttpServer
serverInstance
-
Constructor Summary
Constructors Constructor Description KawaHttpHandler(gnu.kawa.io.Path resourceRoot)
KawaHttpHandler(String resourceRoot)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addAutoHandler(String uriRoot, String resourceRoot)
static HttpContext
addHandler(String uriRoot, HttpHandler handler)
static void
addStaticFileHandler(String uriRoot, String pathPrefix, String defaultUrl, boolean exitOnClose)
static HttpServer
getServerInstance()
void
handle(HttpExchange t)
static void
maybeStopServer()
static HttpServer
startServer(int port, PrintStream printPortHere)
-
-
-
Field Detail
-
serverInstance
public static HttpServer serverInstance
-
serverBacklog
public static int serverBacklog
-
-
Constructor Detail
-
KawaHttpHandler
public KawaHttpHandler(String resourceRoot)
-
KawaHttpHandler
public KawaHttpHandler(gnu.kawa.io.Path resourceRoot)
-
-
Method Detail
-
handle
public void handle(HttpExchange t) throws IOException
- Specified by:
handle
in interfaceHttpHandler
- Throws:
IOException
-
getServerInstance
public static HttpServer getServerInstance() throws IOException
- Throws:
IOException
-
maybeStopServer
public static void maybeStopServer()
-
addAutoHandler
public static void addAutoHandler(String uriRoot, String resourceRoot) throws IOException
- Throws:
IOException
-
addHandler
public static HttpContext addHandler(String uriRoot, HttpHandler handler) throws IOException
- Throws:
IOException
-
addStaticFileHandler
public static void addStaticFileHandler(String uriRoot, String pathPrefix, String defaultUrl, boolean exitOnClose) throws IOException
- Throws:
IOException
-
startServer
public static HttpServer startServer(int port, PrintStream printPortHere) throws IOException
- Throws:
IOException
-
-