public final class HttpConnectionThread
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CRLF
HTTP standard byte sequence for end-of-line.
|
Constructor and Description |
---|
HttpConnectionThread(java.net.Socket socket,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,PathHandler>> methodToPathToHandlerMap,
HttpServer serverInstance)
Create a new connection thread for a particular inbound client.
|
Modifier and Type | Method and Description |
---|---|
HttpServer |
getServerInstance()
Get the server instance associated with this thread.
|
void |
run()
DO NOT CALL.
|
void |
sendError(int error,
java.lang.Object... args)
Produce an HTTP error page with the specified HTTP response error code.
|
public static final java.lang.String CRLF
public HttpConnectionThread(java.net.Socket socket, java.util.Map<java.lang.String,java.util.Map<java.lang.String,PathHandler>> methodToPathToHandlerMap, HttpServer serverInstance) throws java.io.IOException
socket
- Socket obtained from the ServerSocket.accept() methodmethodToPathToHandlerMap
- the Map of Maps of URL paths to PathHandler
instances
registered within this webserverserverInstance
- the HttpServer instance which launched this threadjava.io.IOException
- if thread could not be created for any reasonpublic void run()
run
in interface java.lang.Runnable
public void sendError(int error, java.lang.Object... args)
error
- error code (as defined by the HTTP RFC)args
- other text to be printed after the error code numberHttpURLConnection
public HttpServer getServerInstance()