Class HttpResponse


  • public class HttpResponse
    extends Object

    Provides a HttpResponse value object class.

    Since:
    5.0.0
    • Constructor Detail

      • HttpResponse

        public HttpResponse()
    • Method Detail

      • getPathContent

        public Path getPathContent()
        Return the content as a Path object, or null if not defined.
        Returns:
        the content as Path object
      • getDocumentContent

        public Document getDocumentContent()
        Return the content as a XML Document object, or null if not defined.
        Returns:
        the content as a XML Document object, or null if not defined.
      • getHeaders

        public Map<String,​String> getHeaders()
        Return the map of HTTP response headers.
        Returns:
        the map of HTTP response headers
      • setHeaders

        public HttpResponse setHeaders​(Map<String,​String> headers)
        Set the map of HTTP response headers.
        Parameters:
        headers - the map of HTTP response headers
        Returns:
        the HttpResponse value object
      • isStatusOK

        public boolean isStatusOK()
        Return true if the HTTP response status code is OK (200).
        Returns:
        true if the HTTP response status code is OK (200).
      • isStatusNotFound

        public boolean isStatusNotFound()
        Return true if the HTTP response status code is NOT FOUND (404).
        Returns:
        true if the HTTP response status code is NOT FOUND (404).
      • isInformational

        public boolean isInformational()
        Return true if HTTP response is an informational status code (100-199).
        Returns:
        true if HTTP response is an informational status code (100-199).
      • isSuccess

        public boolean isSuccess()
        Return true if HTTP response is an success status code (200-299).
        Returns:
        true if HTTP response is an success status code (200-299).
      • isRedirection

        public boolean isRedirection()
        Return true if HTTP response is an redirection status code (300-399).
        Returns:
        true if HTTP response is an redirection status code (300-399).
      • isClientError

        public boolean isClientError()
        Return true if HTTP response is an client error status code (400-499).
        Returns:
        true if HTTP response is an client error status code (400-499).
      • isServerError

        public boolean isServerError()
        Return true if HTTP response is an server error status code (500-599).
        Returns:
        true if HTTP response is an server error status code (500-599).
      • getStatus

        public int getStatus()
        Returns:
        the HTTP response status code
      • setStatus

        public HttpResponse setStatus​(int status)
        Parameters:
        status - the status to set
        Returns:
        the HttpResponse value object
      • getStatusLine

        public String getStatusLine()
        Returns:
        the statusLine
      • setStatusLine

        public HttpResponse setStatusLine​(String statusLine)
        Parameters:
        statusLine - the statusLine to set
        Returns:
        the HttpResponse value object
      • getContent

        public byte[] getContent()
        Returns:
        the content
      • setContent

        public HttpResponse setContent​(byte[] content)
        Parameters:
        content - the content to set
        Returns:
        the HttpResponse value object
      • getContentLength

        public long getContentLength()
        Returns:
        the contentLength
      • setContentLength

        public HttpResponse setContentLength​(long contentLength)
        Parameters:
        contentLength - the contentLength to set
        Returns:
        the HttpResponse value object
      • getContentType

        public String getContentType()
        Returns:
        the contentType
      • setContentType

        public HttpResponse setContentType​(String contentType)
        Parameters:
        contentType - the contentType to set
        Returns:
        the HttpResponse value object
      • getContentEncoding

        public String getContentEncoding()
        Returns:
        the contentEncoding
      • setContentEncoding

        public HttpResponse setContentEncoding​(String contentEncoding)
        Parameters:
        contentEncoding - the contentEncoding to set
        Returns:
        the HttpResponse value object
      • getTextContent

        public String getTextContent()
        Return the content as a UTF-8 encoded string, or null if not defined.
        Returns:
        the content as a UTF-8 encoded string, or null if not defined.
      • setTextContent

        public HttpResponse setTextContent​(String content)
        Sets the text content in the response.
        Parameters:
        content - the plain text content to set
        Returns:
        the HttpResponse value object
        Since:
        5.1.7
      • toString

        public String toString()
        Return the string representation of this class.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this class