Class MessageImpl<T extends MessageImpl<T>>

java.lang.Object
org.forgerock.http.protocol.MessageImpl<T>
Type Parameters:
T - The sub-type of this message.
All Implemented Interfaces:
Closeable, AutoCloseable, Message<T>
Direct Known Subclasses:
Request, Response

public abstract class MessageImpl<T extends MessageImpl<T>> extends Object implements Message<T>
Abstract message base class.
  • Method Details

    • close

      public void close()
      Description copied from interface: Message
      Closes all resources associated with the entity. Any open streams will be closed, and the underlying content reset back to a zero length.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Message<T extends MessageImpl<T>>
      See Also:
    • getEntity

      public final Entity getEntity()
      Description copied from interface: Message
      Returns the entity.
      Specified by:
      getEntity in interface Message<T extends MessageImpl<T>>
      Returns:
      The entity.
    • getHeaders

      public final Headers getHeaders()
      Description copied from interface: Message
      Returns the headers.
      Specified by:
      getHeaders in interface Message<T extends MessageImpl<T>>
      Returns:
      The headers.
    • modifyHeaders

      public T modifyHeaders(Consumer<Headers> headersConsumer)
      Description copied from interface: Message
      Interact with the Headers object from the Message.getHeaders() in a fluent way.
      Specified by:
      modifyHeaders in interface Message<T extends MessageImpl<T>>
      Parameters:
      headersConsumer - A consumer function.
      Returns:
      This message.
    • addHeaders

      public T addHeaders(Header... headers)
      Description copied from interface: Message
      Add one or more headers to the message.
      Specified by:
      addHeaders in interface Message<T extends MessageImpl<T>>
      Parameters:
      headers - The headers.
      Returns:
      This message.
    • putHeaders

      public T putHeaders(Header... headers)
      Description copied from interface: Message
      Put one or more headers to the message. This will overwrite any existing header values for the names of the headers provided.
      Specified by:
      putHeaders in interface Message<T extends MessageImpl<T>>
      Parameters:
      headers - The headers.
      Returns:
      This message.
    • getVersion

      public final String getVersion()
      Description copied from interface: Message
      Returns the protocol version. Default: HTTP/1.1.
      Specified by:
      getVersion in interface Message<T extends MessageImpl<T>>
      Returns:
      The protocol version.