Package org.forgerock.http.protocol
Class MessageImpl<T extends MessageImpl<T>>
- java.lang.Object
-
- org.forgerock.http.protocol.MessageImpl<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addHeaders(Header... headers)
Add one or more headers to the message.void
close()
Closes all resources associated with the entity.Entity
getEntity()
Returns the entity.Headers
getHeaders()
Returns the headers.String
getVersion()
Returns the protocol version.T
modifyHeaders(Consumer<Headers> headersConsumer)
Interact with theHeaders
object from theMessage.getHeaders()
in a fluent way.T
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 Detail
-
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:
Entity.close()
-
getEntity
public final Entity getEntity()
Description copied from interface:Message
Returns the entity.- Specified by:
getEntity
in interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The entity.
-
getHeaders
public final Headers getHeaders()
Description copied from interface:Message
Returns the headers.- Specified by:
getHeaders
in interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The headers.
-
modifyHeaders
public T modifyHeaders(Consumer<Headers> headersConsumer)
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
public T addHeaders(Header... headers)
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
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 interfaceMessage<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 interfaceMessage<T extends MessageImpl<T>>
- Returns:
- The protocol version.
-
-