Interface HttpClient.ConnectionResponse

Enclosing class:
HttpClient

public static interface HttpClient.ConnectionResponse
A wrapper for the HTTP connection response.
Since:
15229
  • Method Details

    • getResponseVersion

      Gets the HTTP version from the HTTP response.
      Returns:
      the HTTP version from the HTTP response
    • getResponseCode

      Gets the status code from an HTTP response message. For example, in the case of the following status lines:
       HTTP/1.0 200 OK
       HTTP/1.0 401 Unauthorized
       
      It will return 200 and 401 respectively. Returns -1 if no code can be discerned from the response (i.e., the response is not valid HTTP).
      Returns:
      the HTTP Status-Code, or -1
      Throws:
      IOException - if an error occurred connecting to the server.
    • getContentLengthLong

      Returns the value of the content-length header field as a long.
      Returns:
      the content length of the resource that this connection's URL references, or -1 if the content length is not known.
    • getHeaderFields

      Returns an unmodifiable Map of the header fields. The Map keys are Strings that represent the response-header field names. Each Map value is an unmodifiable List of Strings that represents the corresponding field values.
      Returns:
      a Map of header fields
    • getHeaderField

      Returns the value of the named header field.
      Parameters:
      name - the name of a header field.
      Returns:
      the value of the named header field, or null if there is no such field in the header.