Package com.hyperwallet.clientsdk.util
Class Message<T extends Message<T>>
- java.lang.Object
-
- com.hyperwallet.clientsdk.util.Message<T>
-
- Type Parameters:
T- A Type that extends Message (eitherRequestorResponse)
- Direct Known Subclasses:
Request
public abstract class Message<T extends Message<T>> extends Object
This class represents an HTTP Message, which could either be a Request or a Response. Message is an abstract class that contains fields and methods that are common to both types of Messages.
-
-
Constructor Summary
Constructors Constructor Description Message()The default constructor is a no-op constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaddHeader(String name, String value)Adds a single header value to the Message.StringgetBody()Returns the Message body (also known as the Entity body).StringgetHeader(String label)Map<String,List<String>>getHeaders()List<String>getHeaders(String label)TremoveHeader(String name)Removes the specified header.TsetBody(String body)Sets the body of the Message.TsetHeaders(Map<String,List<String>> headers)Sets all of the headers in one call.
-
-
-
Method Detail
-
getBody
public String getBody()
Returns the Message body (also known as the Entity body).- Returns:
- The body of the HTTP Message. It will typically be HTML, JSON, or XML.
-
setBody
public T setBody(String body)
Sets the body of the Message.- Parameters:
body- This is typically the JSON, XML, or Form Parameters being sent to the server.- Returns:
- this Message, to support chained method calls
-
addHeader
public T addHeader(String name, String value)
Adds a single header value to the Message.- Parameters:
name- The header name.value- The header value- Returns:
- this Message, to support chained method calls
-
removeHeader
public T removeHeader(String name)
Removes the specified header.- Parameters:
name- The name of the header to remove.- Returns:
- this Message, to support chained method calls
-
-