Home / Class/ DefaultHttpRequest Class — netty Architecture

DefaultHttpRequest Class — netty Architecture

Architecture documentation for the DefaultHttpRequest class in DefaultHttpRequest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3aec80e9_799e_23ce_171a_c2abf29d7378["DefaultHttpRequest"]
  a3b0edf1_0fa2_a697_91ce_51b0cf0f9cf9["DefaultHttpRequest.java"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|defined in| a3b0edf1_0fa2_a697_91ce_51b0cf0f9cf9
  0d5ec8f7_630e_152a_47af_6d02268de9ef["DefaultHttpRequest()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| 0d5ec8f7_630e_152a_47af_6d02268de9ef
  a19e373c_6525_f4b1_9c71_026e0c932a1d["HttpMethod()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| a19e373c_6525_f4b1_9c71_026e0c932a1d
  b4740d32_06d1_c2e8_3e80_3dd48f166dfb["String()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| b4740d32_06d1_c2e8_3e80_3dd48f166dfb
  e99b7621_14c2_fe82_05fb_68d03c339928["HttpRequest()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| e99b7621_14c2_fe82_05fb_68d03c339928
  32716e78_e39a_1301_e644_e3e823ba0b5d["hashCode()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| 32716e78_e39a_1301_e644_e3e823ba0b5d
  f596abc1_353e_f425_bb2b_2f82349418ee["equals()"]
  3aec80e9_799e_23ce_171a_c2abf29d7378 -->|method| f596abc1_353e_f425_bb2b_2f82349418ee

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpRequest.java lines 24–165

public class DefaultHttpRequest extends DefaultHttpMessage implements HttpRequest {
    private static final int HASH_CODE_PRIME = 31;
    private HttpMethod method;
    private String uri;

    /**
     * Creates a new instance.
     *
     * @param httpVersion the HTTP version of the request
     * @param method      the HTTP method of the request
     * @param uri         the URI or path of the request
     */
    public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri) {
        this(httpVersion, method, uri, headersFactory().newHeaders());
    }

    /**
     * Creates a new instance.
     *
     * @param httpVersion       the HTTP version of the request
     * @param method            the HTTP method of the request
     * @param uri               the URI or path of the request
     * @param validateHeaders   validate the header names and values when adding them to the {@link HttpHeaders}
     * @deprecated Prefer the {@link #DefaultHttpRequest(HttpVersion, HttpMethod, String)} constructor instead,
     * to always have header validation enabled.
     */
    @Deprecated
    public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri, boolean validateHeaders) {
        this(httpVersion, method, uri, headersFactory().withValidation(validateHeaders));
    }

    /**
     * Creates a new instance.
     *
     * @param httpVersion       the HTTP version of the request
     * @param method            the HTTP method of the request
     * @param uri               the URI or path of the request
     * @param headersFactory    the {@link HttpHeadersFactory} used to create the headers for this Request.
     * The recommended default is {@link DefaultHttpHeadersFactory#headersFactory()}.
     */
    public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri,
                              HttpHeadersFactory headersFactory) {
        this(httpVersion, method, uri, headersFactory.newHeaders());
    }

    /**
     * Creates a new instance.
     *
     * @param httpVersion       the HTTP version of the request
     * @param method            the HTTP method of the request
     * @param uri               the URI or path of the request
     * @param headers           the Headers for this Request
     */
    public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri, HttpHeaders headers) {
        this(httpVersion, method, uri, headers, true);
    }

    /**
     * Creates a new instance.
     *
     * @param httpVersion       the HTTP version of the request
     * @param method            the HTTP method of the request
     * @param uri               the URI or path of the request
     * @param headers           the Headers for this Request
     */
    public DefaultHttpRequest(HttpVersion httpVersion, HttpMethod method, String uri, HttpHeaders headers,
                              boolean validateRequestLine) {
        super(httpVersion, headers);
        this.method = checkNotNull(method, "method");
        this.uri = checkNotNull(uri, "uri");
        if (validateRequestLine) {
            HttpUtil.validateRequestLineTokens(method, uri);
        }
    }

    @Override
    @Deprecated
    public HttpMethod getMethod() {
        return method();
    }

Frequently Asked Questions

What is the DefaultHttpRequest class?
DefaultHttpRequest is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpRequest.java.
Where is DefaultHttpRequest defined?
DefaultHttpRequest is defined in codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpRequest.java at line 24.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free