Package io.servicetalk.http.api
Class HttpProtocolVersion
- java.lang.Object
-
- io.servicetalk.http.api.HttpProtocolVersion
-
- All Implemented Interfaces:
ConnectionInfo.Protocol
public final class HttpProtocolVersion extends java.lang.Object implements ConnectionInfo.Protocol
HTTP protocol versioning.
-
-
Field Summary
Fields Modifier and Type Field Description static HttpProtocolVersion
HTTP_1_0
HTTP/1.0 version described in RFC 1945.static HttpProtocolVersion
HTTP_1_1
HTTP/1.1 version described in RFC 7230.static HttpProtocolVersion
HTTP_2_0
HTTP/2.0 version described in RFC 7540.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
int
major()
Get the <major> portion of the http protocol version.int
minor()
Get the <minor> portion of the http protocol version.java.lang.String
name()
Returns name of the protocol.static HttpProtocolVersion
of(int major, int minor)
java.lang.String
toString()
void
writeTo(Buffer buffer)
Write the equivalent of thisHttpProtocolVersion
to aBuffer
.
-
-
-
Field Detail
-
HTTP_1_1
public static final HttpProtocolVersion HTTP_1_1
HTTP/1.1 version described in RFC 7230.
-
HTTP_1_0
public static final HttpProtocolVersion HTTP_1_0
HTTP/1.0 version described in RFC 1945.
-
HTTP_2_0
public static final HttpProtocolVersion HTTP_2_0
HTTP/2.0 version described in RFC 7540.
-
-
Method Detail
-
of
public static HttpProtocolVersion of(int major, int minor)
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:
java.lang.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
public void writeTo(Buffer buffer)
Write the equivalent of thisHttpProtocolVersion
to aBuffer
.- Parameters:
buffer
- theBuffer
to write to
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
name
public java.lang.String name()
Description copied from interface:ConnectionInfo.Protocol
Returns name of the protocol.- Specified by:
name
in interfaceConnectionInfo.Protocol
- Returns:
- name of the protocol
-
-