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
Modifier and TypeFieldDescriptionstatic final HttpProtocolVersion
HTTP/1.0 version described in RFC 1945.static final HttpProtocolVersion
HTTP/1.1 version described in RFC 7230.static final HttpProtocolVersion
HTTP/2.0 version described in RFC 7540. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(HttpProtocolVersion that) boolean
Resolves and return the http version number as a String.int
hashCode()
int
major()
Get the <major> portion of the http protocol version.int
minor()
Get the <minor> portion of the http protocol version.name()
Returns name of the protocol.static HttpProtocolVersion
of
(int major, int minor) toString()
void
Write the equivalent of thisHttpProtocolVersion
to aBuffer
.
-
Field Details
-
Method Details
-
of
Returns anHttpProtocolVersion
for the specifiedmajor
andminor
. Generally, the constants inHttpProtocolVersion
should 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
- ifmajor
orminor
is 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 thisHttpProtocolVersion
to aBuffer
.- Parameters:
buffer
- theBuffer
to write to
-
equals
-
hashCode
public int hashCode() -
toString
-
name
Description copied from interface:ConnectionInfo.Protocol
Returns name of the protocol.- Specified by:
name
in 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:
compareTo
in interfaceComparable<HttpProtocolVersion>
-