Package server

Class GetChatsHandler

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

public class GetChatsHandler extends Object implements HttpHandler
This http handler class handles the requesting of chatlists that a user is a member in.
  • Constructor Details

    • GetChatsHandler

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

    • handle

      public void handle(HttpExchange httpexchange) throws IOException
      This handles the get_chats http request. Responds with a serialized json string of an array of Strings with the chat names that the user is part of Will respond with statuscodes
      -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
      Test with "curl http://fjenhh.me:2345/get_chats/{username}"
      Specified by:
      handle in interface HttpHandler
      Parameters:
      httpexchange - http exchange to be handled by the function
      Throws:
      IOException