Class HttpVersion
- java.lang.Object
-
- org.jboss.netty.handler.codec.http.HttpVersion
-
- All Implemented Interfaces:
java.lang.Comparable<HttpVersion>
public class HttpVersion extends java.lang.Object implements java.lang.Comparable<HttpVersion>
-
-
Field Summary
Fields Modifier and Type Field Description static HttpVersionHTTP_1_0HTTP/1.0static HttpVersionHTTP_1_1HTTP/1.1private booleankeepAliveDefaultprivate intmajorVersionprivate intminorVersionprivate java.lang.StringprotocolNameprivate java.lang.Stringtextprivate static java.util.regex.PatternVERSION_PATTERN
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(HttpVersion o)booleanequals(java.lang.Object o)intgetMajorVersion()Returns the name of the protocol such as1in"HTTP/1.0".intgetMinorVersion()Returns the name of the protocol such as0in"HTTP/1.0".java.lang.StringgetProtocolName()Returns the name of the protocol such as"HTTP"in"HTTP/1.0".java.lang.StringgetText()Returns the full protocol version text such as"HTTP/1.0".inthashCode()booleanisKeepAliveDefault()Returnstrueif and only if the connection is kept alive unless the"Connection"header is set to"close"explicitly.java.lang.StringtoString()Returns the full protocol version text such as"HTTP/1.0".static HttpVersionvalueOf(java.lang.String text)Returns an existing or newHttpVersioninstance which matches to the specified protocol version string.
-
-
-
Field Detail
-
VERSION_PATTERN
private static final java.util.regex.Pattern VERSION_PATTERN
-
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
-
protocolName
private final java.lang.String protocolName
-
majorVersion
private final int majorVersion
-
minorVersion
private final int minorVersion
-
text
private final java.lang.String text
-
keepAliveDefault
private final boolean keepAliveDefault
-
-
Constructor Detail
-
HttpVersion
public HttpVersion(java.lang.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-trueif and only if the connection is kept alive unless the"Connection"header is set to"close"explicitly.
-
HttpVersion
public HttpVersion(java.lang.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-trueif and only if the connection is kept alive unless the"Connection"header is set to"close"explicitly.
-
-
Method Detail
-
valueOf
public static HttpVersion valueOf(java.lang.String text)
Returns an existing or newHttpVersioninstance which matches to the specified protocol version string. If the specifiedtextis equal to"HTTP/1.0",HTTP_1_0will be returned. If the specifiedtextis equal to"HTTP/1.1",HTTP_1_1will be returned. Otherwise, a newHttpVersioninstance will be returned.
-
getProtocolName
public java.lang.String 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 as1in"HTTP/1.0".
-
getMinorVersion
public int getMinorVersion()
Returns the name of the protocol such as0in"HTTP/1.0".
-
getText
public java.lang.String getText()
Returns the full protocol version text such as"HTTP/1.0".
-
isKeepAliveDefault
public boolean isKeepAliveDefault()
Returnstrueif and only if the connection is kept alive unless the"Connection"header is set to"close"explicitly.
-
toString
public java.lang.String toString()
Returns the full protocol version text such as"HTTP/1.0".- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(HttpVersion o)
- Specified by:
compareToin interfacejava.lang.Comparable<HttpVersion>
-
-