Package org.ka2ddo.yaac.webserver
Class HttpConnectionThread
java.lang.Object
org.ka2ddo.yaac.webserver.HttpConnectionThread
- All Implemented Interfaces:
Runnable
This class processes one inbound HTTP connection.
- Author:
- Andrew Pavlin, KA2DDO
-
Field Summary
-
Constructor Summary
ConstructorDescriptionHttpConnectionThread
(Socket socket, Map<String, Map<String, PathHandler>> methodToPathToHandlerMap, HttpServer serverInstance) Create a new connection thread for a particular inbound client. -
Method Summary
Modifier and TypeMethodDescriptionGet the server instance associated with this thread.void
run()
DO NOT CALL.void
Produce an HTTP error page with the specified HTTP response error code.
-
Field Details
-
CRLF
HTTP standard byte sequence for end-of-line.- See Also:
-
-
Constructor Details
-
HttpConnectionThread
public HttpConnectionThread(Socket socket, Map<String, Map<String, throws IOExceptionPathHandler>> methodToPathToHandlerMap, HttpServer serverInstance) Create a new connection thread for a particular inbound client.- Parameters:
socket
- Socket obtained from the ServerSocket.accept() methodmethodToPathToHandlerMap
- the Map of Maps of URL paths toPathHandler
instances registered within this webserverserverInstance
- the HttpServer instance which launched this thread- Throws:
IOException
- if thread could not be created for any reason
-
-
Method Details
-
run
public void run()DO NOT CALL. Reader thread executor for the enclosing HttpConnectionThread. -
sendError
Produce an HTTP error page with the specified HTTP response error code.- Parameters:
error
- error code (as defined by the HTTP RFC)args
- other text to be printed after the error code number- See Also:
-
getServerInstance
Get the server instance associated with this thread.- Returns:
- HttpServer that created this thread instance
-