From 5b9aa76efd2530c4ea1ac417966ec9374fbae516 Mon Sep 17 00:00:00 2001 From: Ngoc Dao Date: Sun, 11 Dec 2011 12:13:20 +0900 Subject: [PATCH] Fix #116 --- .../http/websocketx/WebSocketServerHandshaker00.java | 9 ++++++--- .../http/websocketx/WebSocketServerHandshaker10.java | 9 ++++++--- .../http/websocketx/WebSocketServerHandshaker17.java | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java index 916bdce7ed..646037c732 100644 --- a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java +++ b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java @@ -34,9 +34,12 @@ import io.netty.buffer.ChannelBuffer; import io.netty.buffer.ChannelBuffers; import io.netty.channel.Channel; import io.netty.channel.ChannelPipeline; +import io.netty.handler.codec.http.HttpChunkAggregator; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpHeaders.Names; import io.netty.handler.codec.http.HttpHeaders.Values; @@ -175,12 +178,12 @@ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker { // Upgrade the connection and send the handshake response. ChannelPipeline p = channel.getPipeline(); - p.remove("aggregator"); - p.replace("decoder", "wsdecoder", new WebSocket00FrameDecoder()); + p.remove(HttpChunkAggregator.class); + p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket00FrameDecoder()); channel.write(res); - p.replace("encoder", "wsencoder", new WebSocket00FrameEncoder()); + p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket00FrameEncoder()); } /** diff --git a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java index fd4f2d5d1e..30ae72e957 100644 --- a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java +++ b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java @@ -24,9 +24,12 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelPipeline; +import io.netty.handler.codec.http.HttpChunkAggregator; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpHeaders.Names; import io.netty.logging.InternalLogger; @@ -143,9 +146,9 @@ public class WebSocketServerHandshaker10 extends WebSocketServerHandshaker { // Upgrade the connection and send the handshake response. ChannelPipeline p = channel.getPipeline(); - p.remove("aggregator"); - p.replace("decoder", "wsdecoder", new WebSocket08FrameDecoder(true, this.allowExtensions)); - p.replace("encoder", "wsencoder", new WebSocket08FrameEncoder(false)); + p.remove(HttpChunkAggregator.class); + p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket08FrameDecoder(true, this.allowExtensions)); + p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket08FrameEncoder(false)); } diff --git a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java index fedb3e01b5..45383cbe09 100644 --- a/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java +++ b/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java @@ -24,9 +24,12 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelPipeline; +import io.netty.handler.codec.http.HttpChunkAggregator; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpRequest; +import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpHeaders.Names; import io.netty.logging.InternalLogger; @@ -143,9 +146,9 @@ public class WebSocketServerHandshaker17 extends WebSocketServerHandshaker { // Upgrade the connection and send the handshake response. ChannelPipeline p = channel.getPipeline(); - p.remove("aggregator"); - p.replace("decoder", "wsdecoder", new WebSocket13FrameDecoder(true, this.allowExtensions)); - p.replace("encoder", "wsencoder", new WebSocket13FrameEncoder(false)); + p.remove(HttpChunkAggregator.class); + p.replace(HttpRequestDecoder.class, "wsdecoder", new WebSocket13FrameDecoder(true, this.allowExtensions)); + p.replace(HttpResponseEncoder.class, "wsencoder", new WebSocket13FrameEncoder(false)); }