Class HttpVersion
java.lang.Object
io.netty.handler.codec.http.HttpVersion
- All Implemented Interfaces:
java.lang.Comparable<HttpVersion>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]static final HttpVersionHTTP/1.0(package private) static final java.lang.Stringstatic final HttpVersionHTTP/1.1(package private) static final java.lang.Stringprivate final booleanprivate final intprivate static final intprivate static final intprivate final intprivate final java.lang.Stringprivate final java.lang.String -
Constructor Summary
ConstructorsModifierConstructorDescriptionHttpVersion(java.lang.String text, boolean keepAliveDefault) Creates a new HTTP version with the specified version string.(package private)HttpVersion(java.lang.String text, boolean strict, boolean keepAliveDefault) HttpVersion(java.lang.String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault) Creates a new HTTP version with the specified protocol name and version numbers.privateHttpVersion(java.lang.String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault, boolean bytes) -
Method Summary
Modifier and TypeMethodDescriptionint(package private) voidbooleanequals(java.lang.Object o) private static booleanhasControlOrWhitespace(java.lang.String s, int end) inthashCode()booleanReturnstrueif and only if the connection is kept alive unless the"Connection"header is set to"close"explicitly.intReturns the name of the protocol such as1in"HTTP/1.0".intReturns the name of the protocol such as0in"HTTP/1.0".private static intparseInt(java.lang.String text, int start, int end) java.lang.StringReturns the name of the protocol such as"HTTP"in"HTTP/1.0".java.lang.Stringtext()Returns the full protocol version text such as"HTTP/1.0".private static inttoDecimal(int value) 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.(package private) static HttpVersionvalueOf(java.lang.String text, boolean strict) private static HttpVersionversion0(java.lang.String text) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
HTTP_1_0_STRING
static final java.lang.String HTTP_1_0_STRING- See Also:
-
HTTP_1_1_STRING
static final java.lang.String HTTP_1_1_STRING- See Also:
-
MAX_INT_DIV_10
private static final int MAX_INT_DIV_10- See Also:
-
MAX_INT_MOD_10
private static final int MAX_INT_MOD_10- See Also:
-
HTTP_1_0
HTTP/1.0 -
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 -
bytes
private final byte[] bytes
-
-
Constructor Details
-
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
HttpVersion(java.lang.String text, boolean strict, boolean keepAliveDefault) -
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.
-
HttpVersion
private HttpVersion(java.lang.String protocolName, int majorVersion, int minorVersion, boolean keepAliveDefault, boolean bytes)
-
-
Method Details
-
valueOf
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. -
valueOf
-
version0
-
hasControlOrWhitespace
private static boolean hasControlOrWhitespace(java.lang.String s, int end) -
parseInt
private static int parseInt(java.lang.String text, int start, int end) -
toDecimal
private static int toDecimal(int value) -
protocolName
public java.lang.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 as1in"HTTP/1.0". -
minorVersion
public int minorVersion()Returns the name of the protocol such as0in"HTTP/1.0". -
text
public java.lang.String text()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
- Specified by:
compareToin interfacejava.lang.Comparable<HttpVersion>
-
encode
-