java.lang.Object
java.lang.Thread
org.cybergarage.http.HTTPServerThread
All Implemented Interfaces:
Runnable

public class HTTPServerThreadextends Thread
A thread that handles HTTP requests for an HTTPServer. Each thread manages a single client connection, reading requests and delegating them to the server's request listeners.
  • Field Details

    • httpServer

      private HTTPServer httpServer
      The server handling the request.
    • sock

      private Socket sock
      The client connection being served.
  • Constructor Details

    • HTTPServerThread

      public HTTPServerThread(HTTPServer httpServer, Socket sock)
      Creates a new HTTPServerThread to handle a client connection.
      Parameters:
      httpServer - the HTTPServer that will handle the requests
      sock - the client socket
  • Method Details

    • run

      public void run()
      Runs the thread to handle HTTP requests from the client. Reads requests continuously until the connection is closed or keep-alive is not requested.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread