public abstract class PathHandler
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected HttpServer |
httpServer
Reference to HttpServer instance that uses invocations of this PathHandler instance.
|
static java.lang.String |
TEXT_HTML_CHARSET_UTF_8
Predefined constant Content-Type string for HTML.
|
| Constructor and Description |
|---|
PathHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
escPrint(java.io.PrintWriter pw,
java.lang.String text)
This method prints a String to the output PrintWriter, doing HTML escapes for any
reserved characters.
|
HttpServer |
getHttpServer()
Get the HttpServer instance associated with this PathHandler.
|
abstract java.lang.String |
processPage(HttpConnectionThread hct,
java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders,
java.io.DataInputStream in,
java.io.OutputStream out,
java.lang.String path)
Given an inbound HTTP request, generate a page using its parameters.
|
void |
setHttpServer(HttpServer httpServer)
Set the HttpServer instance associated with this PathHandler.
|
public static final java.lang.String TEXT_HTML_CHARSET_UTF_8
protected HttpServer httpServer
protected static void escPrint(java.io.PrintWriter pw,
java.lang.String text)
pw - PrintWriter to receive the escaped texttext - String to output with escapespublic abstract java.lang.String processPage(HttpConnectionThread hct, java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders, java.io.DataInputStream in, java.io.OutputStream out, java.lang.String path) throws java.io.IOException
hct - HttpConnectionThread issuing the callrequestHeaders - the HTTP request headers the browser sentin - DataInputStream for reading the body of the HTTP requestout - OutputStream to write the generated page topath - the remainder of the URL following the prefix identifying this particular page, in case the user is providing parameters to the pagejava.io.IOException - if the page could not be generated for some reasonpublic HttpServer getHttpServer()
public void setHttpServer(HttpServer httpServer)
httpServer - HttpServer instance to associate