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 HttpProtocolVersionHTTP_1_0HTTP/1.0 version described in RFC 1945.static HttpProtocolVersionHTTP_1_1HTTP/1.1 version described in RFC 7230.static HttpProtocolVersionHTTP_2_0HTTP/2.0 version described in RFC 7540.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()intmajor()Get the <major> portion of the http protocol version.intminor()Get the <minor> portion of the http protocol version.java.lang.Stringname()Returns name of the protocol.static HttpProtocolVersionof(int major, int minor)java.lang.StringtoString()voidwriteTo(Buffer buffer)Write the equivalent of thisHttpProtocolVersionto 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 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:
java.lang.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
public void writeTo(Buffer buffer)
Write the equivalent of thisHttpProtocolVersionto aBuffer.- Parameters:
buffer- theBufferto write to
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
name
public java.lang.String name()
Description copied from interface:ConnectionInfo.ProtocolReturns name of the protocol.- Specified by:
namein interfaceConnectionInfo.Protocol- Returns:
- name of the protocol
-
-