Reactor Netty 中的 ByteBuf 分配器

ByteBuf allocator in Reactor Netty

有没有办法在请求处理程序中获取 Reactor Netty 中使用的 ByteBuf 分配器?类似于如何在纯 Netty 中做 final ByteBufAllocator byteBufAllocator = ctx.alloc();

HttpServer.create()
        .host("0.0.0.0")
        .port(8080)
        .route(routes -> {
          routes.ws("/ws", (in, out) ->  
            // how to get the allocator here?
          });
        })

您可以像这样从 WebSocketOutboundHttpServerResponse 访问 ByteBufAllocator

HttpServer.create()
        .host("0.0.0.0")
        .port(8080)
        .route(routes -> routes
                .ws("/ws", (in, out) -> {
                    ByteBufAllocator alloc = out.alloc();
                    // ...
                })
                .get("/path", (request, response) -> {
                    ByteBufAllocator alloc = response.alloc();
                    // ...
                })
        );