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.
|
protected static long |
MINUTES_15
Number of milliseconds in 15 minutes.
|
protected static long |
MINUTES_30
Number of milliseconds in 30 minutes.
|
protected static java.awt.Color |
PURPLE
Color to use for station ages that are in the future (i.e., their station clock is
off).
|
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(NonshareableBufferedPrintStream ps,
java.lang.String text)
This method prints a String to the output PrintStream, doing HTML escapes for any
reserved characters.
|
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.
|
protected static void |
outputFooterLinks(NonshareableBufferedPrintStream pOut,
java.util.ResourceBundle msgBundle)
Output the standard footer links for the YAAC webserver.
|
abstract java.lang.String |
processPage(HttpConnectionThread hct,
java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders,
java.io.DataInput 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 static final java.awt.Color PURPLE
protected static final long MINUTES_30
protected static final long MINUTES_15
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 escapesprotected static void escPrint(NonshareableBufferedPrintStream ps, java.lang.String text)
ps
- NonshareableBufferedPrintStream to receive the escaped texttext
- String to output with escapesprotected static void outputFooterLinks(NonshareableBufferedPrintStream pOut, java.util.ResourceBundle msgBundle)
pOut
- NonshareableBufferedPrintStream to write the HTML text tomsgBundle
- ResourceBundle to handle any text localizationspublic abstract java.lang.String processPage(HttpConnectionThread hct, java.util.LinkedHashMap<java.lang.String,java.lang.String> requestHeaders, java.io.DataInput 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
- DataInput 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