public class HttpVersion extends Object implements Comparable<HttpVersion>
Modifier and Type | Field and Description |
---|---|
static HttpVersion |
HTTP_1_0
HTTP/1.0
|
static HttpVersion |
HTTP_1_1
HTTP/1.1
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HttpVersion o) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isKeepAliveDefault()
Returns
true 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 as
1 in "HTTP/1.0" . |
int |
minorVersion()
Returns the name of the protocol such as
0 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 new
HttpVersion instance which matches to
the specified protocol version string. |
public static final HttpVersion HTTP_1_0
public static final HttpVersion HTTP_1_1
public HttpVersion(String text, boolean keepAliveDefault)
keepAliveDefault
- true
if and only if the connection is kept alive unless
the "Connection"
header is set to "close"
explicitly.public HttpVersion(String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault)
keepAliveDefault
- true
if and only if the connection is kept alive unless
the "Connection"
header is set to "close"
explicitly.public static HttpVersion valueOf(String text)
HttpVersion
instance which matches to
the specified protocol version string. If the specified text
is
equal to "HTTP/1.0"
, HTTP_1_0
will be returned. If the
specified text
is equal to "HTTP/1.1"
, HTTP_1_1
will be returned. Otherwise, a new HttpVersion
instance will be
returned.public String protocolName()
"HTTP"
in "HTTP/1.0"
.public int majorVersion()
1
in "HTTP/1.0"
.public int minorVersion()
0
in "HTTP/1.0"
.public String text()
"HTTP/1.0"
.public boolean isKeepAliveDefault()
true
if and only if the connection is kept alive unless
the "Connection"
header is set to "close"
explicitly.public String toString()
"HTTP/1.0"
.public int compareTo(HttpVersion o)
compareTo
in interface Comparable<HttpVersion>
Copyright © 2008–2017 The Netty Project. All rights reserved.