Package org.forgerock.http.protocol
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>
Abstract message base class.
-
Method Summary
Modifier and TypeMethodDescriptionaddHeaders
(Header... headers) Add one or more headers to the message.void
close()
Closes all resources associated with the entity.final Entity
Returns the entity.final Headers
Returns the headers.final String
Returns the protocol version.modifyHeaders
(Consumer<Headers> headersConsumer) Interact with theHeaders
object from theMessage.getHeaders()
in a fluent way.putHeaders
(Header... headers) Put one or more headers to the message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.forgerock.http.protocol.Message
setEntity, setVersion
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceMessage<T extends MessageImpl<T>>
- See Also:
-
getEntity
Description copied from interface:Message
Returns the entity.- Specified by:
getEntity
in interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The entity.
-
getHeaders
Description copied from interface:Message
Returns the headers.- Specified by:
getHeaders
in interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The headers.
-
modifyHeaders
Description copied from interface:Message
Interact with theHeaders
object from theMessage.getHeaders()
in a fluent way.- Specified by:
modifyHeaders
in interfaceMessage<T extends MessageImpl<T>>
- Parameters:
headersConsumer
- A consumer function.- Returns:
- This message.
-
addHeaders
Description copied from interface:Message
Add one or more headers to the message.- Specified by:
addHeaders
in interfaceMessage<T extends MessageImpl<T>>
- Parameters:
headers
- The headers.- Returns:
- This message.
-
putHeaders
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 interfaceMessage<T extends MessageImpl<T>>
- Parameters:
headers
- The headers.- Returns:
- This message.
-
getVersion
Description copied from interface:Message
Returns the protocol version. Default:HTTP/1.1
.- Specified by:
getVersion
in interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The protocol version.
-