Home / Class/ HttpIntermediaryHandler Class — netty Architecture

HttpIntermediaryHandler Class — netty Architecture

Architecture documentation for the HttpIntermediaryHandler class in HttpProxyServer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9524a40e_7347_772c_235c_c78f441b7632["HttpIntermediaryHandler"]
  28810160_ce2b_65e9_e2bc_c0ffa3db9787["HttpProxyServer.java"]
  9524a40e_7347_772c_235c_c78f441b7632 -->|defined in| 28810160_ce2b_65e9_e2bc_c0ffa3db9787
  91005a3a_7b43_4ee7_4384_456793529f8a["handleProxyProtocol()"]
  9524a40e_7347_772c_235c_c78f441b7632 -->|method| 91005a3a_7b43_4ee7_4384_456793529f8a
  567c255f_743a_58c1_013b_d0634b2e6136["SocketAddress()"]
  9524a40e_7347_772c_235c_c78f441b7632 -->|method| 567c255f_743a_58c1_013b_d0634b2e6136

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java lines 107–136

    private final class HttpIntermediaryHandler extends IntermediaryHandler {

        private SocketAddress intermediaryDestination;

        @Override
        protected boolean handleProxyProtocol(ChannelHandlerContext ctx, Object msg) throws Exception {
            FullHttpRequest req = (FullHttpRequest) msg;
            FullHttpResponse res;
            if (!authenticate(ctx, req)) {
                res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.UNAUTHORIZED);
                res.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
            } else {
                res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
                String uri = req.uri();
                int lastColonPos = uri.lastIndexOf(':');
                assertThat(lastColonPos).isGreaterThan(0);
                intermediaryDestination = SocketUtils.socketAddress(
                        uri.substring(0, lastColonPos), Integer.parseInt(uri.substring(lastColonPos + 1)));
            }

            ctx.write(res);
            ctx.pipeline().get(HttpServerCodec.class).removeOutboundHandler();
            return true;
        }

        @Override
        protected SocketAddress intermediaryDestination() {
            return intermediaryDestination;
        }
    }

Frequently Asked Questions

What is the HttpIntermediaryHandler class?
HttpIntermediaryHandler is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java.
Where is HttpIntermediaryHandler defined?
HttpIntermediaryHandler is defined in handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java at line 107.

Analyze Your Own Codebase

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

Try Supermodel Free