HttpVersion Class — netty Architecture
Architecture documentation for the HttpVersion class in HttpVersion.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 059554be_05d5_d829_931e_2aaea4cf530a["HttpVersion"] c1ac9ee1_337f_468c_ad0f_87ce5c637d42["HttpVersion.java"] 059554be_05d5_d829_931e_2aaea4cf530a -->|defined in| c1ac9ee1_337f_468c_ad0f_87ce5c637d42 e61d65d2_fa6e_7ea2_3820_3b783eb54836["HttpVersion()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| e61d65d2_fa6e_7ea2_3820_3b783eb54836 c3c676e5_d341_3b9e_5b7e_41348ba9e601["hasWhitespace()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| c3c676e5_d341_3b9e_5b7e_41348ba9e601 d421ba7d_9261_911e_73db_1227319b5031["parseInt()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| d421ba7d_9261_911e_73db_1227319b5031 01b3632a_321d_d4bc_8f7e_b235cb5f5843["toDecimal()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| 01b3632a_321d_d4bc_8f7e_b235cb5f5843 c6bdb76e_5797_658e_0c68_e17e2069b57c["String()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| c6bdb76e_5797_658e_0c68_e17e2069b57c 9d016a79_cca8_743a_9211_0a0f1dadc0a3["majorVersion()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| 9d016a79_cca8_743a_9211_0a0f1dadc0a3 2ccb70fd_45da_d943_dcd2_0557e494ceb0["minorVersion()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| 2ccb70fd_45da_d943_dcd2_0557e494ceb0 455ecd67_5a87_8fe4_59ff_48b44e9e4bd1["isKeepAliveDefault()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| 455ecd67_5a87_8fe4_59ff_48b44e9e4bd1 0b35f243_3cfb_8743_6179_4da4a132c012["hashCode()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| 0b35f243_3cfb_8743_6179_4da4a132c012 a76da3d8_4152_d859_dfb1_16b19ea34105["equals()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| a76da3d8_4152_d859_dfb1_16b19ea34105 e511826d_90a6_76c6_c9de_65346e488e07["compareTo()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| e511826d_90a6_76c6_c9de_65346e488e07 bbfb30ba_d3f1_e17d_f389_10a34ae43bab["encode()"] 059554be_05d5_d829_931e_2aaea4cf530a -->|method| bbfb30ba_d3f1_e17d_f389_10a34ae43bab
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java lines 30–309
public class HttpVersion implements Comparable<HttpVersion> {
static final String HTTP_1_0_STRING = "HTTP/1.0";
static final String HTTP_1_1_STRING = "HTTP/1.1";
/**
* HTTP/1.0
*/
public static final HttpVersion HTTP_1_0 = new HttpVersion("HTTP", 1, 0, false, true);
/**
* HTTP/1.1
*/
public static final HttpVersion HTTP_1_1 = new HttpVersion("HTTP", 1, 1, true, true);
/**
* Returns an existing or new {@link HttpVersion} instance which matches to
* the specified protocol version string. If the specified {@code text} is
* equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the
* specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1}
* will be returned. Otherwise, a new {@link HttpVersion} instance will be
* returned.
*/
public static HttpVersion valueOf(String text) {
return valueOf(text, false);
}
static HttpVersion valueOf(String text, boolean strict) {
ObjectUtil.checkNotNull(text, "text");
// super fast-path
if (text == HTTP_1_1_STRING) {
return HTTP_1_1;
}
if (text == HTTP_1_0_STRING) {
return HTTP_1_0;
}
text = text.trim();
if (text.isEmpty()) {
throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)");
}
// Try to match without convert to uppercase first as this is what 99% of all clients
// will send anyway. Also there is a change to the RFC to make it clear that it is
// expected to be case-sensitive
//
// See:
// * https://trac.tools.ietf.org/wg/httpbis/trac/ticket/1
// * https://trac.tools.ietf.org/wg/httpbis/trac/wiki
//
HttpVersion version = version0(text);
if (version == null) {
version = new HttpVersion(text, strict, true);
}
return version;
}
private static HttpVersion version0(String text) {
if (HTTP_1_1_STRING.equals(text)) {
return HTTP_1_1;
}
if (HTTP_1_0_STRING.equals(text)) {
return HTTP_1_0;
}
return null;
}
private final String protocolName;
private final int majorVersion;
private final int minorVersion;
private final String text;
private final boolean keepAliveDefault;
private final byte[] bytes;
/**
* 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
* <a href="https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a> and
Source
Frequently Asked Questions
What is the HttpVersion class?
HttpVersion is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java.
Where is HttpVersion defined?
HttpVersion is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free