Do not call static methods via instances

This commit is contained in:
Trustin Lee 2012-11-12 11:23:06 +09:00
parent f1e382c89d
commit 15642f2cd8
5 changed files with 13 additions and 12 deletions

View File

@ -61,7 +61,7 @@ public class WebSocketServerProtocolHandshakeHandler extends ChannelInboundMessa
getWebSocketLocation(ctx.pipeline(), req, websocketPath), subprotocols, allowExtensions); getWebSocketLocation(ctx.pipeline(), req, websocketPath), subprotocols, allowExtensions);
final WebSocketServerHandshaker handshaker = wsFactory.newHandshaker(req); final WebSocketServerHandshaker handshaker = wsFactory.newHandshaker(req);
if (handshaker == null) { if (handshaker == null) {
wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel()); WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
} else { } else {
final ChannelFuture handshakeFuture = handshaker.handshake(ctx.channel(), req); final ChannelFuture handshakeFuture = handshaker.handshake(ctx.channel(), req);
handshakeFuture.addListener(new ChannelFutureListener() { handshakeFuture.addListener(new ChannelFutureListener() {

View File

@ -15,10 +15,6 @@
*/ */
package io.netty.example.http.websocketx.autobahn; package io.netty.example.http.websocketx.autobahn;
import static io.netty.handler.codec.http.HttpHeaders.*;
import static io.netty.handler.codec.http.HttpMethod.*;
import static io.netty.handler.codec.http.HttpResponseStatus.*;
import static io.netty.handler.codec.http.HttpVersion.*;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
@ -41,6 +37,11 @@ import io.netty.logging.InternalLogger;
import io.netty.logging.InternalLoggerFactory; import io.netty.logging.InternalLoggerFactory;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
import static io.netty.handler.codec.http.HttpHeaders.*;
import static io.netty.handler.codec.http.HttpMethod.*;
import static io.netty.handler.codec.http.HttpResponseStatus.*;
import static io.netty.handler.codec.http.HttpVersion.*;
/** /**
* Handles handshakes and messages * Handles handshakes and messages
*/ */
@ -76,7 +77,7 @@ public class AutobahnServerHandler extends ChannelInboundMessageHandlerAdapter<O
getWebSocketLocation(req), null, false, Integer.MAX_VALUE); getWebSocketLocation(req), null, false, Integer.MAX_VALUE);
handshaker = wsFactory.newHandshaker(req); handshaker = wsFactory.newHandshaker(req);
if (handshaker == null) { if (handshaker == null) {
wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel()); WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
} else { } else {
handshaker.handshake(ctx.channel(), req); handshaker.handshake(ctx.channel(), req);
} }

View File

@ -97,7 +97,7 @@ public class WebSocketServerHandler extends ChannelInboundMessageHandlerAdapter<
getWebSocketLocation(req), null, false); getWebSocketLocation(req), null, false);
handshaker = wsFactory.newHandshaker(req); handshaker = wsFactory.newHandshaker(req);
if (handshaker == null) { if (handshaker == null) {
wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel()); WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
} else { } else {
handshaker.handshake(ctx.channel(), req); handshaker.handshake(ctx.channel(), req);
} }

View File

@ -99,7 +99,7 @@ public class WebSocketSslServerHandler extends ChannelInboundMessageHandlerAdapt
getWebSocketLocation(req), null, false); getWebSocketLocation(req), null, false);
handshaker = wsFactory.newHandshaker(req); handshaker = wsFactory.newHandshaker(req);
if (handshaker == null) { if (handshaker == null) {
wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel()); WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
} else { } else {
handshaker.handshake(ctx.channel(), req); handshaker.handshake(ctx.channel(), req);
} }

View File

@ -477,12 +477,12 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
@Override @Override
public boolean hasNextOutboundByteBuffer() { public boolean hasNextOutboundByteBuffer() {
return pipeline.hasNextOutboundByteBuffer(prev); return DefaultChannelPipeline.hasNextOutboundByteBuffer(prev);
} }
@Override @Override
public boolean hasNextOutboundMessageBuffer() { public boolean hasNextOutboundMessageBuffer() {
return pipeline.hasNextOutboundMessageBuffer(prev); return DefaultChannelPipeline.hasNextOutboundMessageBuffer(prev);
} }
@Override @Override
@ -560,12 +560,12 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
@Override @Override
public ByteBuf nextOutboundByteBuffer() { public ByteBuf nextOutboundByteBuffer() {
return pipeline.nextOutboundByteBuffer(prev); return DefaultChannelPipeline.nextOutboundByteBuffer(prev);
} }
@Override @Override
public MessageBuf<Object> nextOutboundMessageBuffer() { public MessageBuf<Object> nextOutboundMessageBuffer() {
return pipeline.nextOutboundMessageBuffer(prev); return DefaultChannelPipeline.nextOutboundMessageBuffer(prev);
} }
@Override @Override