public class HttpVersion extends java.lang.Object implements java.lang.Comparable<HttpVersion>
Modifier and Type | Field and Description |
---|---|
private byte[] |
bytes |
static HttpVersion |
HTTP_1_0
HTTP/1.0
|
private static java.lang.String |
HTTP_1_0_STRING |
static HttpVersion |
HTTP_1_1
HTTP/1.1
|
private static java.lang.String |
HTTP_1_1_STRING |
private boolean |
keepAliveDefault |
private int |
majorVersion |
private int |
minorVersion |
private java.lang.String |
protocolName |
private java.lang.String |
text |
private static java.util.regex.Pattern |
VERSION_PATTERN |
Modifier | Constructor and Description |
---|---|
|
HttpVersion(java.lang.String text,
boolean keepAliveDefault)
Creates a new HTTP version with the specified version string.
|
|
HttpVersion(java.lang.String protocolName,
int majorVersion,
int minorVersion,
boolean keepAliveDefault)
Creates a new HTTP version with the specified protocol name and version
numbers.
|
private |
HttpVersion(java.lang.String protocolName,
int majorVersion,
int minorVersion,
boolean keepAliveDefault,
boolean bytes) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HttpVersion o) |
(package private) void |
encode(ByteBuf buf) |
boolean |
equals(java.lang.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" . |
java.lang.String |
protocolName()
Returns the name of the protocol such as
"HTTP" in "HTTP/1.0" . |
java.lang.String |
text()
Returns the full protocol version text such as
"HTTP/1.0" . |
java.lang.String |
toString()
Returns the full protocol version text such as
"HTTP/1.0" . |
static HttpVersion |
valueOf(java.lang.String text)
Returns an existing or new
HttpVersion instance which matches to
the specified protocol version string. |
private static HttpVersion |
version0(java.lang.String text) |
private static final java.util.regex.Pattern VERSION_PATTERN
private static final java.lang.String HTTP_1_0_STRING
private static final java.lang.String HTTP_1_1_STRING
public static final HttpVersion HTTP_1_0
public static final HttpVersion HTTP_1_1
private final java.lang.String protocolName
private final int majorVersion
private final int minorVersion
private final java.lang.String text
private final boolean keepAliveDefault
private final byte[] bytes
public HttpVersion(java.lang.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(java.lang.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.private HttpVersion(java.lang.String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault, boolean bytes)
public static HttpVersion valueOf(java.lang.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.private static HttpVersion version0(java.lang.String text)
public java.lang.String protocolName()
"HTTP"
in "HTTP/1.0"
.public int majorVersion()
1
in "HTTP/1.0"
.public int minorVersion()
0
in "HTTP/1.0"
.public java.lang.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 java.lang.String toString()
"HTTP/1.0"
.toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(HttpVersion o)
compareTo
in interface java.lang.Comparable<HttpVersion>
void encode(ByteBuf buf)