Enum ResponseStatus

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ResponseStatus>

    public enum ResponseStatus
    extends java.lang.Enum<ResponseStatus>
    All the REST response statuses.
    • Enum Constant Detail

      • Ok

        public static final ResponseStatus Ok
        200 OK - Resource found and all good.
      • Created

        public static final ResponseStatus Created
        201 - Resource was created.
      • Accepted

        public static final ResponseStatus Accepted
        202 - Request was accepted.
      • PartialContent

        public static final ResponseStatus PartialContent
        206 - Partial content.
      • NotModified

        public static final ResponseStatus NotModified
        304 Not Modified
      • BadRequest

        public static final ResponseStatus BadRequest
        400 - Request was not correct.
      • Unauthorized

        public static final ResponseStatus Unauthorized
        401 - Request Unauthorized
      • Forbidden

        public static final ResponseStatus Forbidden
        403 - Request forbidden
      • NotFound

        public static final ResponseStatus NotFound
        404 Not Found - Resource was not found.
      • MethodNotAllowed

        public static final ResponseStatus MethodNotAllowed
        405 Method Not Allowed - Method in request is not allowed on the resource
      • ProxyAuthenticationRequired

        public static final ResponseStatus ProxyAuthenticationRequired
        407 - Proxy authentication required
      • Conflict

        public static final ResponseStatus Conflict
        409 - Request conflicts with the current state of the server
      • Gone

        public static final ResponseStatus Gone
        410 Gone - Resource has been deleted or has expired.
      • PreconditionFailed

        public static final ResponseStatus PreconditionFailed
        412 Precondition Failed - The conditions given in the request header fields evaluated to false
      • RequestTooLarge

        public static final ResponseStatus RequestTooLarge
        413 Request Entity Too Large - The request is larger than what the server is willing to accept
      • RangeNotSatisfiable

        public static final ResponseStatus RangeNotSatisfiable
        416 Range Not Satisfiable - A range request is invalid or outside of the bounds of an object.
      • TooManyRequests

        public static final ResponseStatus TooManyRequests
        429 Application rate limit exceeded/Application quota limit exceeded.
      • InternalServerError

        public static final ResponseStatus InternalServerError
        500 - Internal server failure resulted in request not being honored.
      • ServiceUnavailable

        public static final ResponseStatus ServiceUnavailable
        503 - Service is unavailable
      • InsufficientCapacity

        public static final ResponseStatus InsufficientCapacity
        507 - Insufficient capacity to complete the request.
    • Method Detail

      • values

        public static ResponseStatus[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ResponseStatus c : ResponseStatus.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ResponseStatus valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getStatusCode

        public int getStatusCode()
        Returns:
        status code of this ResponseStatus
      • isSuccess

        public boolean isSuccess()
        Returns:
        true if status code is 2xx which means success. false otherwise.
      • isRedirection

        public boolean isRedirection()
        Returns:
        true if status code is 3xx which means redirection. false otherwise.
      • isClientError

        public boolean isClientError()
        Returns:
        true if status code is 4xx which means client error. false otherwise.
      • isServerError

        public boolean isServerError()
        Returns:
        true if status code is 5xx which means server error. false otherwise.
      • getResponseStatus

        public static ResponseStatus getResponseStatus​(RestServiceErrorCode restServiceErrorCode)
        Gets the ResponseStatus that corresponds to the restServiceErrorCode.
        Parameters:
        restServiceErrorCode - the input RestServiceErrorCode.
        Returns:
        the ResponseStatus that the restServiceErrorCode belongs to.