Package org.apache.hc.core5.http
Class Message<H extends MessageHeaders,B>
- java.lang.Object
-
- org.apache.hc.core5.http.Message<H,B>
-
- Type Parameters:
H- message head type.B- message body type.
public final class Message<H extends MessageHeaders,B> extends java.lang.ObjectGeneric message consisting of a message head and a message body.- Since:
- 5.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Bbody()Gets the message body.java.lang.Objecterror()static <H extends MessageHeaders,B>
Message<H,B>error(H head, java.lang.Object error)Create a new message with the given head and error.BgetBody()Gets the message body.HgetHead()Gets the message head.Hhead()Gets the message head.static <H extends MessageHeaders,B>
Message<H,B>of(H head, B body)Create a new message with the given head and body, and no error.java.lang.StringtoString()
-
-
-
Method Detail
-
of
public static <H extends MessageHeaders,B> Message<H,B> of(H head, B body)
Create a new message with the given head and body, and no error.- Parameters:
head- The message head.body- The message body.- Since:
- 5.5
-
error
public static <H extends MessageHeaders,B> Message<H,B> error(H head, java.lang.Object error)
Create a new message with the given head and error.- Parameters:
head- The message head.error- The untyped object containing error details.- Since:
- 5.5
-
head
public H head()
Gets the message head.- Returns:
- the message head.
- Since:
- 5.5
-
getHead
public H getHead()
Gets the message head.- Returns:
- the message head.
-
body
public B body()
Gets the message body.- Returns:
- the message body.
- Since:
- 5.5
-
getBody
public B getBody()
Gets the message body.- Returns:
- the message body.
-
error
public java.lang.Object error()
- Since:
- 5.5
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-