Package server

Class ConnectHandler

java.lang.Object
server.ConnectHandler
All Implemented Interfaces:
HttpHandler

public class ConnectHandler extends Object implements HttpHandler
This class the connect http handler which handles the joining/connecting to a chat room.
  • Constructor Details

    • ConnectHandler

      public ConnectHandler(DatabaseHandler databaseHandler)
      Constructor
      Parameters:
      databaseHandler - handles the database connection, writing/reading.
  • Method Details

    • handle

      public void handle(HttpExchange httpexchange) throws IOException
      This handles the http request depending on the Request type. Will respond with statuscodes will never return any data to the requestee.
      -200 OK
      -400 Bad Request, if an exception was raised in the json parsing or addition of the user in the database
      -405 Method Not Allowed, if POST request method was not used
      Specified by:
      handle in interface HttpHandler
      Parameters:
      httpexchange - http exchange to be handled by the function
      Throws:
      IOException