Package io.servicetalk.http.api
Class HttpProtocolVersion
java.lang.Object
io.servicetalk.http.api.HttpProtocolVersion
- All Implemented Interfaces:
ConnectionInfo.Protocol,Comparable<HttpProtocolVersion>
public final class HttpProtocolVersion
extends Object
implements ConnectionInfo.Protocol, Comparable<HttpProtocolVersion>
HTTP protocol versioning.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpProtocolVersionHTTP/1.0 version described in RFC 1945.static final HttpProtocolVersionHTTP/1.1 version described in RFC 7230.static final HttpProtocolVersionHTTP/2.0 version described in RFC 7540. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(HttpProtocolVersion that) booleanResolves and return the http version number as a String.inthashCode()intmajor()Get the <major> portion of the http protocol version.intminor()Get the <minor> portion of the http protocol version.name()Returns name of the protocol.static HttpProtocolVersionof(int major, int minor) toString()voidWrite the equivalent of thisHttpProtocolVersionto aBuffer.
-
Field Details
-
Method Details
-
of
Returns anHttpProtocolVersionfor the specifiedmajorandminor. Generally, the constants inHttpProtocolVersionshould be used.- Parameters:
major- the <major> portion of the HTTP protocol versionminor- the <minor> portion of the HTTP protocol version- Returns:
- an
HttpProtocolVersion - Throws:
IllegalArgumentException- ifmajororminoris not a 1-digit integer
-
major
public int major()Get the <major> portion of the http protocol version.- Returns:
- the <major> portion of the http protocol version
-
minor
public int minor()Get the <minor> portion of the http protocol version.- Returns:
- the <minor> portion of the http protocol version
-
writeTo
Write the equivalent of thisHttpProtocolVersionto aBuffer.- Parameters:
buffer- theBufferto write to
-
equals
-
hashCode
public int hashCode() -
toString
-
name
Description copied from interface:ConnectionInfo.ProtocolReturns name of the protocol.- Specified by:
namein interfaceConnectionInfo.Protocol- Returns:
- name of the protocol
-
fullVersion
Resolves and return the http version number as a String. e.g. : 1.1 or 2.0.- Returns:
- the http version number string.
-
compareTo
- Specified by:
compareToin interfaceComparable<HttpProtocolVersion>
-