Class HttpResponse

    • Constructor Detail

      • HttpResponse

        public HttpResponse​(java.net.URL url,
                            int statusCode,
                            byte[] content,
                            java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers)
    • Method Detail

      • getURL

        public java.net.URL getURL()
        Returns:
        The request url
      • getStatusCode

        public int getStatusCode()
        Returns:
        The status code of the response
      • getStatusMessage

        public java.lang.String getStatusMessage()
        Returns:
        The message of the status code
      • getContent

        public byte[] getContent()
        Returns:
        The response body
      • getContentAsString

        public java.lang.String getContentAsString()
        Returns:
        The response body as a string
      • getContentAsString

        public java.lang.String getContentAsString​(java.nio.charset.Charset charset)
        Get the response body as a string with the given charset.
        Parameters:
        charset - The charset to use
        Returns:
        The response body as a string
      • getContentType

        public java.util.Optional<ContentType> getContentType()
        Returns:
        The content type of the response