Class HttpStatus


  • public class HttpStatus
    extends java.lang.Object
    Value object for HTTP status code and invariants associated with it.
    • Field Detail

      • CONTINUE

        public static final HttpStatus CONTINUE
      • MULTIPLE_CHOICES

        public static final HttpStatus MULTIPLE_CHOICES
      • BAD_REQUEST

        public static final HttpStatus BAD_REQUEST
      • INTERNAL_SERVER_ERROR

        public static final HttpStatus INTERNAL_SERVER_ERROR
    • Method Detail

      • valueOf

        public static HttpStatus valueOf​(int code)
        Creates new status code from the status code value.
        Parameters:
        code - a status code value, e.g. 200 for OK, 404 for not found, etc.
        Returns:
        an HttpCode initialized to the status code value.
      • isSuccessful

        public boolean isSuccessful()
        Determines whether the status code indicates a successful processing
        Returns:
        true only, if the status code belongs to the SUCCESS group of 2xx values; false, otherwise.
      • isError

        public boolean isError()
        Determines whether the status code indicates an error processing
        Returns:
        true only, if the status code belongs to either USER ERROR group with 4xx values or to SERVER ERROR group with 5xx values; false, otherwise.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object