使用Netty 4.0.0.Beta1,將輸入/輸出HTTP流量記錄到基於netty的服務器的最佳方式是什麼?我的管道是目前:如何在Netty 4.0.0.Beta1中記錄HTTP請求/響應?
p.addLast("decoder", new HttpRequestDecoder());
p.addLast("aggregator", new HttpObjectAggregator(1048576));
p.addLast("encoder", new HttpResponseEncoder());
p.addLast("handler", new MyBusinessLogicHandler());
我試着寫一個實現ChannelInboundMessageHandler<FullHttpRequest>
處理程序,然後執行在inboundBufferUpdated(ChannelHandlerContext ctx)
方法,這似乎對傳入的請求做工精細,而且是推薦的方式記錄?
當我試圖實施ChannelOutboundMessageHandler<FullHttpResponse>
時,我看不到flush(ChannelHandlerContext ctx, ChannelPromise promise)
方法中的實際FullHttpResponse對象。
對此提出建議?謝謝!
所以我或多或少的認識到,我在放置日誌處理程序的地方遇到了一個簡單的問題。我仍在實施'ChannelInboundMessageHandler'&'ChannelOutboundMessageHandler '。這是最好的方法嗎? –
Baron
2013-02-26 00:47:56
是的,這是做到這一點的最佳方式。 – 2013-02-26 09:00:11