Class InboundMessage

java.lang.Object
com.tccc.kos.commons.web.websocket.router.msg.RoutedMessage
com.tccc.kos.commons.web.websocket.router.msg.InboundMessage

public class InboundMessage extends RoutedMessage
All inbound messages to the router are in text form since they originate from a websocket message. Only the headers are parsed in this message, the body is still in raw string form.
Since:
1.0
Version:
2022-10-26
  • Constructor Details

    • InboundMessage

      public InboundMessage(WebsocketConnection conn, String str)
      Create a new message from the specified string.
      Parameters:
      conn - the connection on which the message arrived (optional)
      str - the incoming message to parse
    • InboundMessage

      public InboundMessage(String body)
      Create an inbound message from the serialized body of an outbound message and empty headers.
      Parameters:
      body - the serialized body
    • InboundMessage

      public InboundMessage(Map<String,String> headers, String body)
      Create an inbound message from the headers and serialized body of an outbound message.
      Parameters:
      headers - the outbound headers
      body - the serialized body
  • Method Details

    • setBody

      public void setBody(String body)
      Set the unparsed body of the message. This will mark the headers modified to ensure the message is regenerated using the body.
      Parameters:
      body - the new unparsed body
    • getConn

      public WebsocketConnection getConn()
    • getRawMsg

      public String getRawMsg()
    • getBody

      public String getBody()
      Description copied from class: RoutedMessage
      Returns the body of the message.
      Specified by:
      getBody in class RoutedMessage
      Returns:
      the message body
    • setRawMsg

      public void setRawMsg(String rawMsg)