org.apache.hc.core5.http.message

## Class StatusLine

- java.lang.Object
- - org.apache.hc.core5.http.message.StatusLine

- All Implemented Interfaces:
    Serializable

      @Contract(threading=IMMUTABLE)
      public final class StatusLine
      extends Object
      implements Serializable

  HTTP/1.1 status line.
  Since:
    4.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `StatusLine.StatusClass` Standard classes of HTTP status codes, plus `OTHER` for non-standard codes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatusLine(HttpResponse response)`
    `StatusLine(ProtocolVersion version, int statusCode, String reasonPhrase)` Creates a new status line with the given version, status, and reason.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ProtocolVersion` | `getProtocolVersion()`
    `String` | `getReasonPhrase()`
    `StatusLine.StatusClass` | `getStatusClass()`
    `int` | `getStatusCode()`
    `boolean` | `isClientError()` Whether this status code is in the HTTP series `StatusLine.StatusClass.CLIENT_ERROR`.
    `boolean` | `isError()` Whether this status code is in the HTTP series `StatusLine.StatusClass.CLIENT_ERROR` or `StatusLine.StatusClass.SERVER_ERROR`.
    `boolean` | `isInformational()` Whether this status code is in the HTTP series `StatusLine.StatusClass.INFORMATIONAL`.
    `boolean` | `isRedirection()` Whether this status code is in the HTTP series `StatusLine.StatusClass.REDIRECTION`.
    `boolean` | `isServerError()` Whether this status code is in the HTTP series `StatusLine.StatusClass.SERVER_ERROR`.
    `boolean` | `isSuccessful()` Whether this status code is in the HTTP series `StatusLine.StatusClass.SUCCESSFUL`.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### StatusLine

          public StatusLine(HttpResponse response)

    - #### StatusLine

          public StatusLine(ProtocolVersion version,
                            int statusCode,
                            String reasonPhrase)

      Creates a new status line with the given version, status, and reason.
      Parameters:
        `version` - the protocol version of the response
        `statusCode` - the status code of the response
        `reasonPhrase` - the reason phrase to the status code, or `null`

  - ### Method Detail

    - #### getStatusCode

          public int getStatusCode()

    - #### getStatusClass

          public StatusLine.StatusClass getStatusClass()

    - #### isInformational

          public boolean isInformational()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.INFORMATIONAL`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.INFORMATIONAL`.
      Since:
        5.1

    - #### isSuccessful

          public boolean isSuccessful()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.SUCCESSFUL`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.SUCCESSFUL`.
      Since:
        5.1

    - #### isRedirection

          public boolean isRedirection()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.REDIRECTION`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.REDIRECTION`.
      Since:
        5.1

    - #### isClientError

          public boolean isClientError()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.CLIENT_ERROR`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.CLIENT_ERROR`.
      Since:
        5.1

    - #### isServerError

          public boolean isServerError()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.SERVER_ERROR`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.SERVER_ERROR`.
      Since:
        5.1

    - #### isError

          public boolean isError()

      Whether this status code is in the HTTP series `StatusLine.StatusClass.CLIENT_ERROR` or `StatusLine.StatusClass.SERVER_ERROR`.
      Returns:
        Whether this status code's class is `StatusLine.StatusClass.CLIENT_ERROR` or `StatusLine.StatusClass.SERVER_ERROR`.
      Since:
        5.1

    - #### getProtocolVersion

          public ProtocolVersion getProtocolVersion()

    - #### getReasonPhrase

          public String getReasonPhrase()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.