Class HttpVersion

  • All Implemented Interfaces:
    java.lang.Comparable

    @Deprecated
    public class HttpVersion
    extends java.lang.Object
    implements java.lang.Comparable
    Deprecated.
    Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.

    HTTP version, as specified in RFC 2616.

    HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. The protocol versioning policy is intended to allow the sender to indicate the format of a message and its capacity for understanding further HTTP communication, rather than the features obtained via that communication. No change is made to the version number for the addition of message components which do not affect communication behavior or which only add to extensible field values. The <minor> number is incremented when the changes made to the protocol add features which do not change the general message parsing algorithm, but which may add to the message semantics and imply additional capabilities of the sender. The <major> number is incremented when the format of a message within the protocol is changed. See RFC 2145 [36] for a fuller explanation.

    The version of an HTTP message is indicated by an HTTP-Version field in the first line of the message.

         HTTP-Version   = "HTTP" "/" 1*DIGIT "." 1*DIGIT
      

    Note that the major and minor numbers MUST be treated as separate integers and that each MAY be incremented higher than a single digit. Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is lower than HTTP/12.3. Leading zeros MUST be ignored by recipients and MUST NOT be sent.

    Since:
    3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpVersion​(int major, int minor)
      Deprecated.
      Create an HTTP protocol version designator.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object o)
      Deprecated.
       
      int compareTo​(HttpVersion anotherVer)
      Deprecated.
      Compares this HTTP protocol version with another one.
      boolean equals​(java.lang.Object obj)
      Deprecated.
       
      boolean equals​(HttpVersion version)
      Deprecated.
      Test if the HTTP protocol version is equal to the given number.
      int getMajor()
      Deprecated.
      Returns the major version number of the HTTP protocol.
      int getMinor()
      Deprecated.
      Returns the minor version number of the HTTP protocol.
      boolean greaterEquals​(HttpVersion version)
      Deprecated.
      Test if the HTTP protocol version is greater or equal to the given number.
      int hashCode()
      Deprecated.
       
      boolean lessEquals​(HttpVersion version)
      Deprecated.
      Test if the HTTP protocol version is less or equal to the given number.
      static HttpVersion parse​(java.lang.String s)
      Deprecated.
      Parses the textual representation of the given HTTP protocol version.
      java.lang.String toString()
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • HTTP_0_9

        public static final HttpVersion HTTP_0_9
        Deprecated.
        HTTP protocol version 0.9
      • HTTP_1_0

        public static final HttpVersion HTTP_1_0
        Deprecated.
        HTTP protocol version 1.0
      • HTTP_1_1

        public static final HttpVersion HTTP_1_1
        Deprecated.
        HTTP protocol version 1.1
    • Constructor Detail

      • HttpVersion

        public HttpVersion​(int major,
                           int minor)
        Deprecated.
        Create an HTTP protocol version designator.
        Parameters:
        major - the major version number of the HTTP protocol
        minor - the minor version number of the HTTP protocol
        Throws:
        java.lang.IllegalArgumentException - if either major or minor version number is negative
    • Method Detail

      • getMajor

        public int getMajor()
        Deprecated.
        Returns the major version number of the HTTP protocol.
        Returns:
        the major version number.
      • getMinor

        public int getMinor()
        Deprecated.
        Returns the minor version number of the HTTP protocol.
        Returns:
        the minor version number.
      • hashCode

        public int hashCode()
        Deprecated.
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • equals

        public boolean equals​(java.lang.Object obj)
        Deprecated.
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • compareTo

        public int compareTo​(HttpVersion anotherVer)
        Deprecated.
        Compares this HTTP protocol version with another one.
        Parameters:
        anotherVer - the version to be compared with.
        Returns:
        a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Deprecated.
        Specified by:
        compareTo in interface java.lang.Comparable
        See Also:
        Comparable.compareTo(java.lang.Object)
      • equals

        public boolean equals​(HttpVersion version)
        Deprecated.
        Test if the HTTP protocol version is equal to the given number.
        Returns:
        true if HTTP protocol version is given to the given number, false otherwise.
      • greaterEquals

        public boolean greaterEquals​(HttpVersion version)
        Deprecated.
        Test if the HTTP protocol version is greater or equal to the given number.
        Returns:
        true if HTTP protocol version is greater or equal given to the given number, false otherwise.
      • lessEquals

        public boolean lessEquals​(HttpVersion version)
        Deprecated.
        Test if the HTTP protocol version is less or equal to the given number.
        Returns:
        true if HTTP protocol version is less or equal to given to the given number, false otherwise.
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • parse

        public static HttpVersion parse​(java.lang.String s)
                                 throws ProtocolException
        Deprecated.
        Parses the textual representation of the given HTTP protocol version.
        Returns:
        HTTP protocol version.
        Throws:
        ProtocolException - if the string is not a valid HTTP protocol version.