Enum Status.Family

  • All Implemented Interfaces:
    Serializable, Comparable<Status.Family>
    Enclosing class:
    Status

    public static enum Status.Family
    extends Enum<Status.Family>
    The first digit of the status-code defines the class of response. The last two digits do not have any categorization role. There are five values for the first digit:
    • 1xx (Informational): The request was received, continuing process
    • 2xx (Successful): The request was successfully received, understood, and accepted
    • 3xx (Redirection): Further action needs to be taken in order to complete the request
    • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled
    • 5xx (Server Error): The server failed to fulfill an apparently valid request
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CLIENT_ERROR
      The 4xx (Client Error) class of status code indicates that the client seems to have erred.
      INFORMATIONAL
      The 1xx (Informational) class of status code indicates an interim response for communicating connection status or request progress prior to completing the requested action and sending a final response.
      REDIRECTION
      The 3xx (Redirection) class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request.
      SERVER_ERROR
      The 5xx (Server Error) class of status code indicates that the server is aware that it has erred or is incapable of performing the requested method.
      SUCCESSFUL
      The 2xx (Successful) class of status code indicates that the client's $ request was successfully received, understood, and accepted.
      UNKNOWN
      This class of status code is for all status code above 600, that are not classified in the specification.
    • Enum Constant Detail

      • INFORMATIONAL

        public static final Status.Family INFORMATIONAL
        The 1xx (Informational) class of status code indicates an interim response for communicating connection status or request progress prior to completing the requested action and sending a final response. 1xx responses are terminated by the first empty line after the status-line (the empty line signaling the end of the header section). Since HTTP/1.0 did not define any 1xx status codes, a server MUST NOT send a 1xx response to an HTTP/1.0 client.

        A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses.

        A proxy MUST forward 1xx responses unless the proxy itself requested the generation of the 1xx response. For example, if a proxy adds an "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).

      • SUCCESSFUL

        public static final Status.Family SUCCESSFUL
        The 2xx (Successful) class of status code indicates that the client's $ request was successfully received, understood, and accepted.
      • REDIRECTION

        public static final Status.Family REDIRECTION
        The 3xx (Redirection) class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. If a Location header field (Section 7.1.2) is provided, the user agent MAY automatically redirect its request to the URI referenced by the Location field value, even if the specific status code is not understood. Automatic redirection needs to done with care for methods not known to be safe, as defined in Section 4.2.1, since the user might not wish to redirect an unsafe request.

        There are several types of redirects:

        1. Redirects that indicate the resource might be available at a different URI, as provided by the Location field, as in the status codes 301 (Moved Permanently), 302 (Found), and 307 (Temporary Redirect).
        2. Redirection that offers a choice of matching resources, each capable of representing the original request target, as in the 300 (Multiple Choices) status code.
        3. Redirection to a different resource, identified by the Location field, that can represent an indirect response to the request, as in the 303 (See Other) status code.
        4. Redirection to a previously cached result, as in the 304 (Not Modified) status code.

          Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 302 (Found) were defined for the first type of redirect ([RFC1945], Section 9.3). Early user agents split on whether the method applied to the redirect target would be the same as the original request or would be rewritten as GET. Although HTTP originally defined the former semantics for 301 and 302 (to match its original implementation at CERN), and defined 303 (See Other) to match the latter semantics, prevailing practice gradually converged on the latter semantics for 301 and 302 as well. The first revision of HTTP/1.1 added 307 (Temporary Redirect) to indicate the former semantics without being impacted by divergent practice. Over 10 years later, most user agents still do method rewriting for 301 and 302; therefore, this specification makes that behavior conformant when the original request is POST.

        A client SHOULD detect and intervene in cyclical redirections (i.e., "infinite" redirection loops).
        Note: An earlier version of this specification recommended a maximum of five redirections ([RFC2068], Section 10.3). Content developers need to be aware that some clients might implement such a fixed limitation.

      • CLIENT_ERROR

        public static final Status.Family CLIENT_ERROR
        The 4xx (Client Error) class of status code indicates that the client seems to have erred. Except when responding to a HEAD request, the server SHOULD send a representation containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included representation to the user.
      • SERVER_ERROR

        public static final Status.Family SERVER_ERROR
        The 5xx (Server Error) class of status code indicates that the server is aware that it has erred or is incapable of performing the requested method. Except when responding to a HEAD request, the server SHOULD send a representation containing an explanation of the error situation, and whether it is a temporary or permanent condition. A user agent SHOULD display any included representation to the user. These response codes are applicable to any request method.
      • UNKNOWN

        public static final Status.Family UNKNOWN
        This class of status code is for all status code above 600, that are not classified in the specification.
    • Method Detail

      • values

        public static Status.Family[] 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 (Status.Family c : Status.Family.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Status.Family valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null