Class EthosResponse<T>


  • public class EthosResponse<T>
    extends Object
    Response object used by the Ethos SDK to contain specific response headers, response body content, and the HTTP response status code. This class contains mostly getter methods on attributes to reduce the possibility of response values being changed.
    • Constructor Detail

      • EthosResponse

        public EthosResponse​(Map<String,​org.apache.http.Header> headerMap,
                             String content,
                             int statusCode)
        Instantiates an EthosResponse object with the given parameters. The parameters are intended to be supplied from the EthosResponseBuilder to build this object from an org.apache.http.HttpResponse.
        Parameters:
        headerMap - A map of headers containing the defined header constants in this class as keys.
        content - The response body content.
        statusCode - The Http status code of the response.
    • Method Detail

      • getHeader

        public org.apache.http.Header getHeader​(String headerKey)
        Returns the header for the given key.
        Parameters:
        headerKey - the key used to get the header from the headerMap.
        Returns:
        An org.apache.http.Header object for the given key.
      • getHeaderMapKeys

        public List<String> getHeaderMapKeys()
        Gets the keys in the header map, which can be used to retrieve specific header values from getHeader(String).
        Returns:
        A list of header map keys.
      • getHttpStatusCode

        public int getHttpStatusCode()
        Gets the Http status code of the response.
        Returns:
        The Http status code.
      • getContent

        public String getContent()
        Gets the response body as a String value.
        Returns:
        The response body as a String.
      • getContentAsType

        public T getContentAsType()
        Gets the content as a generic type, if specified with this class.
        Returns:
        The response body content as a generic type.
      • getRequestedUrl

        public String getRequestedUrl()
        Gets the URL which the corresponding request was made for.
        Returns:
        the requested URL.
      • setRequestedUrl

        public void setRequestedUrl​(String requestedUrl)
        Sets the requested URL of the corresponding request.
        Parameters:
        requestedUrl - the requestedUrl to set.
      • setContentAsType

        public void setContentAsType​(T contentAsType)
        Sets the content as a generic type object.
        Parameters:
        contentAsType - The generic type object to set for content.