Package server

Class SendMessageHandler

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

@Deprecated public class SendMessageHandler extends Object implements HttpHandler
Deprecated.
This http handler class handles sending messages to a chat. This class and its functions are considered deprecated. Instead use WebsocketHandler connection for sending messages.
  • Constructor Details

    • SendMessageHandler

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

    • handle

      @Deprecated public void handle(HttpExchange httpexchange) throws IOException
      Deprecated.
      **************************************
      ************Deprecated**************
      **use WebsocketHandler instead**
      **************************************
      Http handler for sending messages to a chat Never Responds with any data.
      Will set 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
      Example: curl --header "Content-type: application/json" --request POST -data '{"chat": "Hennings Privata chat", "message": {"text": "Not so secret message :)", "user": {"name": "Coola Henning"}, "time": "2026-02-04T11:14:05Z"}}' http://fjenhh.me:2345/send_message
      Specified by:
      handle in interface HttpHandler
      Parameters:
      httpexchange - http exchange to be handled by the function
      Throws:
      IOException