Remove transitive dependency on slf4j in example (#8582)

Motivation:

We currently depend on slf4j in an transitive way in one of our classes in the examples. We should not do this.

Modifications:

Remove logging in example.

Result:

Remove not needed dependency.
This commit is contained in:
Norman Maurer 2018-11-21 06:39:28 +01:00
parent e4fae1c98e
commit 63b0f78e56

View File

@ -21,16 +21,12 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketFrame;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Echoes uppercase content of text frames. * Echoes uppercase content of text frames.
*/ */
public class WebSocketFrameHandler extends SimpleChannelInboundHandler<WebSocketFrame> { public class WebSocketFrameHandler extends SimpleChannelInboundHandler<WebSocketFrame> {
private static final Logger logger = LoggerFactory.getLogger(WebSocketFrameHandler.class);
@Override @Override
protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame frame) throws Exception { protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame frame) throws Exception {
// ping and pong frames already handled // ping and pong frames already handled
@ -38,7 +34,6 @@ public class WebSocketFrameHandler extends SimpleChannelInboundHandler<WebSocket
if (frame instanceof TextWebSocketFrame) { if (frame instanceof TextWebSocketFrame) {
// Send the uppercase string back. // Send the uppercase string back.
String request = ((TextWebSocketFrame) frame).text(); String request = ((TextWebSocketFrame) frame).text();
logger.info("{} received {}", ctx.channel(), request);
ctx.channel().writeAndFlush(new TextWebSocketFrame(request.toUpperCase(Locale.US))); ctx.channel().writeAndFlush(new TextWebSocketFrame(request.toUpperCase(Locale.US)));
} else { } else {
String message = "unsupported frame type: " + frame.getClass().getName(); String message = "unsupported frame type: " + frame.getClass().getName();