Module bus.http

Class StatusLine

java.lang.Object
org.miaixz.bus.http.metric.http.StatusLine

public class StatusLine extends Object
Represents the status line of an HTTP response, such as "HTTP/1.1 200 OK".
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • protocol

      public final org.miaixz.bus.core.net.Protocol protocol
      The HTTP protocol, such as Protocol.HTTP_1_1.
    • code

      public final int code
      The HTTP status code, such as 200.
    • message

      public final String message
      The HTTP status message, such as "OK".
  • Constructor Details

    • StatusLine

      public StatusLine(org.miaixz.bus.core.net.Protocol protocol, int code, String message)
  • Method Details

    • get

      public static StatusLine get(Response response)
      Creates a StatusLine from a Response.
      Parameters:
      response - The response to extract the status line from.
      Returns:
      A new StatusLine instance.
    • parse

      public static StatusLine parse(String statusLine) throws IOException
      Parses a status line from a string.
      Parameters:
      statusLine - The status line string.
      Returns:
      A new StatusLine instance.
      Throws:
      IOException - if the status line is malformed.
    • toString

      public String toString()
      Overrides:
      toString in class Object