Class GenHttpResponse


  • public class GenHttpResponse
    extends java.lang.Object
    Implements a HTTP response.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getReason()
      Gets the status message.
      java.lang.String getResponse()
      Gets the response body.
      int getResponseCode()
      Gets the HTTP status code.
      boolean isOk()
      Checks if the response is successful, depending on the status code.
      static GenHttpResponse of​(java.lang.String response)
      Creates a new instance.
      static GenHttpResponse of​(java.lang.String response, int responseCode, java.lang.String reason)
      Creates a new instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getResponse

        public java.lang.String getResponse()
        Gets the response body.
        Returns:
        the response body as string
      • getResponseCode

        public int getResponseCode()
        Gets the HTTP status code.
        Returns:
        the numeric status code
      • getReason

        public java.lang.String getReason()
        Gets the status message.
        Returns:
        a string
      • isOk

        public boolean isOk()
        Checks if the response is successful, depending on the status code.
        Returns:
        true if successful, false otherwise
      • of

        public static GenHttpResponse of​(java.lang.String response)
        Creates a new instance.
        Parameters:
        response - the response body
        Returns:
        a new instance of GenHttpResponse
      • of

        public static GenHttpResponse of​(java.lang.String response,
                                         int responseCode,
                                         java.lang.String reason)
        Creates a new instance.
        Parameters:
        response - the response body
        responseCode - the HTTP status code
        reason - an optional status message
        Returns:
        a new instance of GenHttpResponse