Class HttpVersion

    • Field Detail

      • HTTP_10

        public static final HttpVersion HTTP_10
        HTTP version 1.0.
      • HTTP_11

        public static final HttpVersion HTTP_11
        HTTP version 1.1.
      • HTTP_20

        public static final HttpVersion HTTP_20
        HTTP version 2.0.
      • HTTP_30

        public static final HttpVersion HTTP_30
        HTTP version 3.0.
    • Method Detail

      • getOrCreate

        public static HttpVersion getOrCreate​(int major,
                                              int minor)
        Either acquires a cached HTTP version object matching the given major and minor versions or creates a new one.
        Parameters:
        major - Major HTTP version.
        minor - Minor HTTP version.
        Returns:
        New or existing HTTP version object.
      • major

        public int major()
        Returns:
        HTTP protocol major version.
      • minor

        public int minor()
        Returns:
        HTTP protocol minor version.
      • valueOf

        public static HttpVersion valueOf​(java.lang.String version)
        Resolves HttpVersion from given version string, expected to be on the form "HTTP/<major>.<minor>".

        If parsed version is a standardized such, a cached HttpVersion is returned. Otherwise, a new instance is returned.

        Parameters:
        version - Version to parse. Case sensitive, as required by RFC 7230, Section 2.6.
        Returns:
        Cached or new HttpVersion.
        See Also:
        RFC 7230, Section 2.6
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object