- java.lang.Object
-
- io.netty5.handler.codec.http.HttpVersion
-
- All Implemented Interfaces:
Comparable<HttpVersion>
public class HttpVersion extends Object implements Comparable<HttpVersion>
-
-
Field Summary
Fields Modifier and Type Field Description static HttpVersion
HTTP_1_0
HTTP/1.0static HttpVersion
HTTP_1_1
HTTP/1.1
-
Constructor Summary
Constructors Constructor Description HttpVersion(String text, boolean keepAliveDefault)
Creates a new HTTP version with the specified version string.HttpVersion(String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault)
Creates a new HTTP version with the specified protocol name and version numbers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(HttpVersion o)
boolean
equals(Object o)
int
hashCode()
boolean
isKeepAliveDefault()
Returnstrue
if and only if the connection is kept alive unless the"Connection"
header is set to"close"
explicitly.int
majorVersion()
Returns the name of the protocol such as1
in"HTTP/1.0"
.int
minorVersion()
Returns the name of the protocol such as0
in"HTTP/1.0"
.String
protocolName()
Returns the name of the protocol such as"HTTP"
in"HTTP/1.0"
.String
text()
Returns the full protocol version text such as"HTTP/1.0"
.String
toString()
Returns the full protocol version text such as"HTTP/1.0"
.static HttpVersion
valueOf(String text)
Returns an existing or newHttpVersion
instance which matches to the specified protocol version string.
-
-
-
Field Detail
-
HTTP_1_0
public static final HttpVersion HTTP_1_0
HTTP/1.0
-
HTTP_1_1
public static final HttpVersion HTTP_1_1
HTTP/1.1
-
-
Constructor Detail
-
HttpVersion
public HttpVersion(String text, boolean keepAliveDefault)
Creates a new HTTP version with the specified version string. You will not need to create a new instance unless you are implementing a protocol derived from HTTP, such as RTSP and ICAP.- Parameters:
keepAliveDefault
-true
if and only if the connection is kept alive unless the"Connection"
header is set to"close"
explicitly.
-
HttpVersion
public HttpVersion(String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault)
Creates a new HTTP version with the specified protocol name and version numbers. You will not need to create a new instance unless you are implementing a protocol derived from HTTP, such as RTSP and ICAP- Parameters:
keepAliveDefault
-true
if and only if the connection is kept alive unless the"Connection"
header is set to"close"
explicitly.
-
-
Method Detail
-
valueOf
public static HttpVersion valueOf(String text)
Returns an existing or newHttpVersion
instance which matches to the specified protocol version string. If the specifiedtext
is equal to"HTTP/1.0"
,HTTP_1_0
will be returned. If the specifiedtext
is equal to"HTTP/1.1"
,HTTP_1_1
will be returned. Otherwise, a newHttpVersion
instance will be returned.
-
protocolName
public String protocolName()
Returns the name of the protocol such as"HTTP"
in"HTTP/1.0"
.
-
majorVersion
public int majorVersion()
Returns the name of the protocol such as1
in"HTTP/1.0"
.
-
minorVersion
public int minorVersion()
Returns the name of the protocol such as0
in"HTTP/1.0"
.
-
text
public String text()
Returns the full protocol version text such as"HTTP/1.0"
.
-
isKeepAliveDefault
public boolean isKeepAliveDefault()
Returnstrue
if and only if the connection is kept alive unless the"Connection"
header is set to"close"
explicitly.
-
toString
public String toString()
Returns the full protocol version text such as"HTTP/1.0"
.
-
compareTo
public int compareTo(HttpVersion o)
- Specified by:
compareTo
in interfaceComparable<HttpVersion>
-
-