Class HttpResponse


  • public class HttpResponse
    extends Object
    This class is used to define a response to a http-request
    • Field Detail

      • UNKNOWN_REQUEST

        public static final int UNKNOWN_REQUEST
        Unknown request type error code
        See Also:
        Constant Field Values
      • EXCEPTION

        public static final int EXCEPTION
        Exception thrown error code
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpResponse

        public HttpResponse​(Exception e)
        Initialize an exception thrown HttpResponse with e
        Parameters:
        e - the thrown exception in this http-request processing
      • HttpResponse

        public HttpResponse​(int code,
                            okhttp3.Headers headers,
                            String value)
        Initialize a HttpResponse without exceptions
        Parameters:
        code - the response code
        headers - the response header
        value - the response data
    • Method Detail

      • isError

        public boolean isError()
        Indicate this is an exception thrown HttpResponse
        Returns:
        true if this is an exception thrown HttpResponse, false otherwise
      • getException

        @Nullable
        public @Nullable Exception getException()
      • getCode

        public int getCode()
      • getAsJSON

        @NotNull
        public @NotNull JSON getAsJSON()
        Get the values as JSON instance
        Returns:
        JSON instance of this response data
      • getResponse

        @Nullable
        public @Nullable String getResponse()
      • getHeaders

        @Nullable
        public @Nullable okhttp3.Headers getHeaders()