HTTP2 example server should also log.

Motivation:

The HTTP2 example client logs, and it's useful to show what's
going on.  It'd be sweet if the server did too.

Modifications:

Added Http2FrameLogger to example server pipeline.

Result:

HTTP2 example server will log frames.
This commit is contained in:
Scott Blum 2014-04-15 14:32:28 -04:00 committed by Norman Maurer
parent a992e7fb48
commit 9496c1a4ed
2 changed files with 4 additions and 1 deletions

View File

@ -38,7 +38,7 @@ public class Http2ClientInitializer extends ChannelInitializer<SocketChannel> {
ChannelPipeline pipeline = ch.pipeline(); ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("http2FrameCodec", new Http2FrameCodec()); pipeline.addLast("http2FrameCodec", new Http2FrameCodec());
pipeline.addLast("spdyFrameLogger", new Http2FrameLogger(INFO)); pipeline.addLast("http2FrameLogger", new Http2FrameLogger(INFO));
pipeline.addLast("http2ConnectionHandler", new Http2ConnectionHandler(false)); pipeline.addLast("http2ConnectionHandler", new Http2ConnectionHandler(false));
pipeline.addLast("httpHandler", httpResponseHandler); pipeline.addLast("httpHandler", httpResponseHandler);
} }

View File

@ -16,9 +16,11 @@
package io.netty.example.http2.server; package io.netty.example.http2.server;
import static io.netty.util.internal.logging.InternalLogLevel.INFO;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import io.netty.example.http2.client.Http2FrameLogger;
import io.netty.handler.codec.http2.draft10.connection.Http2ConnectionHandler; import io.netty.handler.codec.http2.draft10.connection.Http2ConnectionHandler;
import io.netty.handler.codec.http2.draft10.frame.Http2FrameCodec; import io.netty.handler.codec.http2.draft10.frame.Http2FrameCodec;
@ -31,6 +33,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
ChannelPipeline p = ch.pipeline(); ChannelPipeline p = ch.pipeline();
p.addLast("http2FrameCodec", new Http2FrameCodec()); p.addLast("http2FrameCodec", new Http2FrameCodec());
p.addLast("http2FrameLogger", new Http2FrameLogger(INFO));
p.addLast("http2ConnectionHandler", new Http2ConnectionHandler(true)); p.addLast("http2ConnectionHandler", new Http2ConnectionHandler(true));
p.addLast("helloWorldHandler", new HelloWorldHandler()); p.addLast("helloWorldHandler", new HelloWorldHandler());
} }