public class LoggingCorsHttpServer extends CorsHttpServer
| Modifier and Type | Class and Description |
|---|---|
private static class |
LoggingCorsHttpServer.CountOutputStream
OutputStream subclass which counts the number of bytes it is being
asked to write, but otherwise does nothing.
|
private class |
LoggingCorsHttpServer.LoggedResponse
HTTP response which will log its content at an appropriate time.
|
HttpServer.Handler, HttpServer.Request, HttpServer.Response| Modifier and Type | Field and Description |
|---|---|
private int |
iSeq_ |
private java.io.PrintStream |
out_ |
EXTRAHOSTS_PROPHDR_CONTENT_TYPE, STATUS_OK| Constructor and Description |
|---|
LoggingCorsHttpServer(java.net.ServerSocket socket,
OriginAuthorizer auth,
java.io.PrintStream out)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
appendBanner(java.lang.StringBuffer sbuf,
char c,
int iseq)
Adds a line to the given stringbuffer which indicates information
relating to a given sequence number follows.
|
private void |
appendHeaders(java.lang.StringBuffer sbuf,
java.util.Map map)
Adds HTTP header information to a string buffer.
|
private void |
logRequest(HttpServer.Request request,
int iseq)
Logs a given request.
|
HttpServer.Response |
serve(HttpServer.Request request)
Does the work for providing output corresponding to a given HTTP request.
|
isPermittedHostaddHandler, create405Response, createErrorResponse, createErrorResponse, getBaseUrl, getHeader, getSocket, isRunning, removeHandler, serveRequest, setDaemon, start, stoppublic LoggingCorsHttpServer(java.net.ServerSocket socket,
OriginAuthorizer auth,
java.io.PrintStream out)
throws java.io.IOException
socket - socket hosting the serviceauth - defines which domains requests will be permitted fromout - destination stream for loggingjava.io.IOExceptionpublic HttpServer.Response serve(HttpServer.Request request)
HttpServerserve in class CorsHttpServerrequest - represents an HTTP request that has been receivedprivate void logRequest(HttpServer.Request request, int iseq)
request - HTTP requestiseq - index of the request; unique integer for each requestprivate void appendBanner(java.lang.StringBuffer sbuf,
char c,
int iseq)
sbuf - string buffer to add toc - filler characteriseq - sequence numberprivate void appendHeaders(java.lang.StringBuffer sbuf,
java.util.Map map)
sbuf - buffer to add lines tomap - header key->value pair map