Class HttpVersion
java.lang.Object
org.jboss.netty.handler.codec.http.HttpVersion
- All Implemented Interfaces:
Comparable<HttpVersion>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpVersion
HTTP/1.0static final HttpVersion
HTTP/1.1private final boolean
private final int
private final int
private final String
private final String
private static final Pattern
-
Constructor Summary
ConstructorsConstructorDescriptionHttpVersion
(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
Modifier and TypeMethodDescriptionint
boolean
int
Returns the name of the protocol such as1
in"HTTP/1.0"
.int
Returns the name of the protocol such as0
in"HTTP/1.0"
.Returns the name of the protocol such as"HTTP"
in"HTTP/1.0"
.getText()
Returns the full protocol version text such as"HTTP/1.0"
.int
hashCode()
boolean
Returnstrue
if and only if the connection is kept alive unless the"Connection"
header is set to"close"
explicitly.toString()
Returns the full protocol version text such as"HTTP/1.0"
.static HttpVersion
Returns an existing or newHttpVersion
instance which matches to the specified protocol version string.
-
Field Details
-
VERSION_PATTERN
-
HTTP_1_0
HTTP/1.0 -
HTTP_1_1
HTTP/1.1 -
protocolName
-
majorVersion
private final int majorVersion -
minorVersion
private final int minorVersion -
text
-
keepAliveDefault
private final boolean keepAliveDefault
-
-
Constructor Details
-
HttpVersion
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 Details
-
valueOf
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. -
getProtocolName
Returns the name of the protocol such as"HTTP"
in"HTTP/1.0"
. -
getMajorVersion
public int getMajorVersion()Returns the name of the protocol such as1
in"HTTP/1.0"
. -
getMinorVersion
public int getMinorVersion()Returns the name of the protocol such as0
in"HTTP/1.0"
. -
getText
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
Returns the full protocol version text such as"HTTP/1.0"
. -
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<HttpVersion>
-