Home / Function/ handlePreflight() — netty Function Reference

handlePreflight() — netty Function Reference

Architecture documentation for the handlePreflight() function in CorsHandler.java from the netty codebase.

Function java ProtocolCodecs HTTP calls 8 called by 1

Entity Profile

Dependency Diagram

graph TD
  a3528954_dd41_114c_963f_7d9056bea918["handlePreflight()"]
  48d2af19_d0e9_a2f5_8280_607eb2335be4["CorsHandler"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|defined in| 48d2af19_d0e9_a2f5_8280_607eb2335be4
  027a5736_cffb_b2ba_1d21_bab8955f01f6["channelRead()"]
  027a5736_cffb_b2ba_1d21_bab8955f01f6 -->|calls| a3528954_dd41_114c_963f_7d9056bea918
  443bc456_062e_6158_b794_7d52bf18c800["setOrigin()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 443bc456_062e_6158_b794_7d52bf18c800
  817d783f_9d20_17f7_20a9_acdde4f05533["setAllowMethods()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 817d783f_9d20_17f7_20a9_acdde4f05533
  33f19a3b_fa3c_49bf_d8c2_24d1bfdea003["setAllowHeaders()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 33f19a3b_fa3c_49bf_d8c2_24d1bfdea003
  d0b437b7_a674_7261_9478_519e18bcedff["setAllowCredentials()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| d0b437b7_a674_7261_9478_519e18bcedff
  9ffe1a97_abd5_dee9_3a75_3cfb8090f4c4["setMaxAge()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 9ffe1a97_abd5_dee9_3a75_3cfb8090f4c4
  95c218d3_1c82_797e_8203_47f2c7d44e6a["setPreflightHeaders()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 95c218d3_1c82_797e_8203_47f2c7d44e6a
  7363a3a0_6f33_0bcf_ea4e_e1be0ab5866f["setAllowPrivateNetwork()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 7363a3a0_6f33_0bcf_ea4e_e1be0ab5866f
  83580d6f_fb90_ca67_d975_fcbf1311a55f["respond()"]
  a3528954_dd41_114c_963f_7d9056bea918 -->|calls| 83580d6f_fb90_ca67_d975_fcbf1311a55f
  style a3528954_dd41_114c_963f_7d9056bea918 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java lines 118–138

    private void handlePreflight(final ChannelHandlerContext ctx, final HttpRequest request) {
        final HttpResponse response = new DefaultFullHttpResponse(
                request.protocolVersion(),
                OK,
                Unpooled.buffer(0),
                DefaultHttpHeadersFactory.headersFactory().withCombiningHeaders(true),
                DefaultHttpHeadersFactory.trailersFactory().withCombiningHeaders(true));
        if (setOrigin(response)) {
            setAllowMethods(response);
            setAllowHeaders(response);
            setAllowCredentials(response);
            setMaxAge(response);
            setPreflightHeaders(response);
            setAllowPrivateNetwork(response);
        }
        if (!response.headers().contains(HttpHeaderNames.CONTENT_LENGTH)) {
            response.headers().set(HttpHeaderNames.CONTENT_LENGTH, HttpHeaderValues.ZERO);
        }
        release(request);
        respond(ctx, request, response);
    }

Subdomains

Called By

Frequently Asked Questions

What does handlePreflight() do?
handlePreflight() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java.
Where is handlePreflight() defined?
handlePreflight() is defined in codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java at line 118.
What does handlePreflight() call?
handlePreflight() calls 8 function(s): respond, setAllowCredentials, setAllowHeaders, setAllowMethods, setAllowPrivateNetwork, setMaxAge, setOrigin, setPreflightHeaders.
What calls handlePreflight()?
handlePreflight() is called by 1 function(s): channelRead.

Analyze Your Own Codebase

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

Try Supermodel Free