Interface HttpClient.ConnectionResponse

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getContentLengthLong()
      Returns the value of the content-length header field as a long.
      java.lang.String getHeaderField​(java.lang.String name)
      Returns the value of the named header field.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaderFields()
      Returns an unmodifiable Map of the header fields.
      int getResponseCode()
      Gets the status code from an HTTP response message.
      java.lang.String getResponseVersion()
      Gets the HTTP version from the HTTP response.
    • Method Detail

      • getResponseVersion

        java.lang.String getResponseVersion()
        Gets the HTTP version from the HTTP response.
        Returns:
        the HTTP version from the HTTP response
      • getResponseCode

        int getResponseCode()
                     throws java.io.IOException
        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:
        java.io.IOException - if an error occurred connecting to the server.
      • getContentLengthLong

        long 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

        java.util.Map<java.lang.String,​java.util.List<java.lang.String>> 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

        java.lang.String getHeaderField​(java.lang.String name)
        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.