cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1514292 - in /cxf/trunk: parent/ rt/transports/http-netty/netty-server/ rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/ rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/tran...
Date Thu, 15 Aug 2013 14:29:10 GMT
Author: ningjiang
Date: Thu Aug 15 14:29:09 2013
New Revision: 1514292

URL: http://svn.apache.org/r1514292
Log:
CXF-5177 Upgrade netty version of netty-server to 4.x

Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/transports/http-netty/netty-server/pom.xml
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngine.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletHandler.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/ChannelInterceptor.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/HttpSessionInterceptor.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/NettyInterceptor.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/ChannelThreadLocal.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpServletRequest.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletOutputStream.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletResponse.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/util/Utils.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Thu Aug 15 14:29:09 2013
@@ -134,8 +134,8 @@
         <cxf.maven.core.version>2.2.1</cxf.maven.core.version>
         <cxf.msv.version>2011.1</cxf.msv.version>
         <cxf.neethi.version>3.0.2</cxf.neethi.version>
-        <cxf.netty.version>3.6.5.Final</cxf.netty.version>
-        <cxf.netty.version.range>[3,4)</cxf.netty.version.range>
+        <cxf.netty.version>4.0.7.Final</cxf.netty.version>
+        <cxf.netty.version.range>[4,5)</cxf.netty.version.range>
         <cxf.oauth.bundle.version>20100527_1</cxf.oauth.bundle.version>
         <cxf.opensaml.version>2.5.3</cxf.opensaml.version>
         <cxf.opensaml.osgi.version>2.5.3_1</cxf.opensaml.osgi.version>

Modified: cxf/trunk/rt/transports/http-netty/netty-server/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/pom.xml?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/pom.xml (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/pom.xml Thu Aug 15 14:29:09 2013
@@ -36,7 +36,7 @@
     
     <properties>
         <cxf.osgi.import>
-	    org.jboss.netty.*;version="${cxf.netty.version.range}",
+	    io.netty.*;version="${cxf.netty.version.range}",
 	    javax.annotation;version="${cxf.osgi.javax.annotation.version}",
 	    org.apache.aries*;version="${cxf.aries.version.range}",
         org.springframework*;resolution:="optional";version="${cxf.osgi.spring.version}"
@@ -55,7 +55,8 @@
 
         <dependency>
             <groupId>io.netty</groupId>
-            <artifactId>netty</artifactId>
+            <artifactId>netty-codec-http</artifactId>
+            <version>${cxf.netty.version}</version>
         </dependency>
 
         <dependency>

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngine.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngine.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngine.java Thu Aug 15 14:29:09 2013
@@ -23,18 +23,17 @@ import java.net.InetSocketAddress;
 import java.net.URL;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
 
 import javax.annotation.PostConstruct;
 
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.transport.HttpUriMapper;
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
-import org.jboss.netty.handler.timeout.IdleStateHandler;
-import org.jboss.netty.util.HashedWheelTimer;
-import org.jboss.netty.util.Timer;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.timeout.IdleStateHandler;
 
 public class NettyHttpServerEngine implements ServerEngine {
 
@@ -58,8 +57,6 @@ public class NettyHttpServerEngine imple
 
     private NettyHttpServletPipelineFactory servletPipeline;
     
-    private Timer timer = new HashedWheelTimer();
-
     private Map<String, NettyHttpContextHandler> handlerMap = new ConcurrentHashMap<String, NettyHttpContextHandler>();
     
     /**
@@ -79,6 +76,10 @@ public class NettyHttpServerEngine imple
     
     private boolean sessionSupport;
     
+    // TODO need to setup configuration about them
+    private EventLoopGroup bossGroup = new NioEventLoopGroup();
+    private EventLoopGroup workerGroup = new NioEventLoopGroup();
+    
     public NettyHttpServerEngine() {
         
     }
@@ -132,13 +133,13 @@ public class NettyHttpServerEngine imple
     }
       
     protected Channel startServer() {
-        // TODO Configure the server.
-        final ServerBootstrap bootstrap = new ServerBootstrap(
-                new NioServerSocketChannelFactory(Executors
-                        .newCachedThreadPool(), Executors.newCachedThreadPool()));
+          
+        final ServerBootstrap bootstrap = new ServerBootstrap();
+        bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class);
+                
         // Set up the idle handler
         IdleStateHandler idleStateHandler = 
-            new IdleStateHandler(this.timer, getReadIdleTime(), getWriteIdleTime(), 0);
+            new IdleStateHandler(getReadIdleTime(), getWriteIdleTime(), 0);
         // Set up the event pipeline factory.
         servletPipeline = 
             new NettyHttpServletPipelineFactory(
@@ -148,7 +149,7 @@ public class NettyHttpServerEngine imple
                  handlerMap, idleStateHandler);
         // Start the servletPipeline's timer
         servletPipeline.start();
-        bootstrap.setPipelineFactory(servletPipeline);
+        bootstrap.childHandler(servletPipeline);
         InetSocketAddress address = null;
         if (host == null) {
             address = new InetSocketAddress(port);
@@ -156,7 +157,12 @@ public class NettyHttpServerEngine imple
             address = new InetSocketAddress(host, port);
         }
         // Bind and start to accept incoming connections.
-        return bootstrap.bind(address);
+        try {
+            return bootstrap.bind(address).sync().channel();
+        } catch (InterruptedException ex) {
+            // do nothing here
+            return null;
+        }
     }
 
 
@@ -202,8 +208,6 @@ public class NettyHttpServerEngine imple
     }
 
     public void shutdown() {
-        // stop the timer
-        timer.stop();
         // just unbind the channel
         if (serverChannel != null) {
             serverChannel.close();
@@ -211,6 +215,20 @@ public class NettyHttpServerEngine imple
         if (servletPipeline != null) {
             servletPipeline.shutdown();
         }
+        bossGroup.shutdownGracefully();
+        workerGroup.shutdownGracefully();
+        
+        // Wait until all threads are terminated.
+        try {
+            bossGroup.terminationFuture().sync();
+        } catch (InterruptedException exception) {
+            // do nothing here;
+        }
+        try {
+            workerGroup.terminationFuture().sync();
+        } catch (InterruptedException exception) {
+            // do nothing here;
+        }
     }
 
     public int getReadIdleTime() {

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletHandler.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletHandler.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletHandler.java Thu Aug 15 14:29:09 2013
@@ -28,31 +28,32 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.transport.http.netty.server.interceptor.NettyInterceptor;
 import org.apache.cxf.transport.http.netty.server.servlet.NettyHttpServletRequest;
 import org.apache.cxf.transport.http.netty.server.servlet.NettyServletResponse;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ChannelFutureListener;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelStateEvent;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.handler.codec.frame.TooLongFrameException;
-import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpResponse;
-import org.jboss.netty.handler.codec.http.HttpResponseStatus;
-import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
-import org.jboss.netty.handler.timeout.IdleStateEvent;
-import org.jboss.netty.util.CharsetUtil;
 
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.group.ChannelGroup;
+import io.netty.handler.codec.TooLongFrameException;
+import io.netty.handler.codec.http.DefaultFullHttpResponse;
+import io.netty.handler.codec.http.DefaultHttpResponse;
+import io.netty.handler.codec.http.FullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpHeaders.Names;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.netty.handler.codec.http.HttpVersion;
+import io.netty.handler.timeout.IdleState;
+import io.netty.util.CharsetUtil;
 
-public class NettyHttpServletHandler extends IdleStateAwareChannelHandler {
+public class NettyHttpServletHandler extends ChannelInboundHandlerAdapter {
     private static final Logger LOG =
             LogUtils.getL7dLogger(NettyHttpServletHandler.class);
+   
     private final ChannelGroup allChannels;
 
     private final NettyHttpServletPipelineFactory pipelineFactory;
@@ -75,54 +76,62 @@ public class NettyHttpServletHandler ext
     }
 
     @Override
-    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
-        throws Exception {
-        LOG.log(Level.FINE, "Opening new channel: {}", e.getChannel().getId());
+    public void channelActive(ChannelHandlerContext ctx) throws Exception {
+        LOG.log(Level.FINE, "Opening new channel: {}", ctx.channel());
         // Agent map
-        allChannels.add(e.getChannel());
+        allChannels.add(ctx.channel());
     }
 
+   
     @Override
-    public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
-        LOG.log(Level.FINE, "Closing idle channel: {}", e.getChannel().getId());
-        e.getChannel().close();
+    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
+        if (evt instanceof IdleState) {
+            IdleState e = (IdleState) evt;
+            if (e == IdleState.READER_IDLE || e == IdleState.WRITER_IDLE) {
+                LOG.log(Level.FINE, "Closing idle channel: {}", e);
+                ctx.close();
+            } 
+        }
     }
-
+    
+    
     @Override
-    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
-        throws Exception {
-
-        HttpRequest request = (HttpRequest) e.getMessage();
+    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+        HttpRequest request = (HttpRequest) msg;
         if (HttpHeaders.is100ContinueExpected(request)) {
-            e.getChannel().write(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
+            ctx.write(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
         }
 
         // find the nettyHttpContextHandler by lookup the request url
         NettyHttpContextHandler nettyHttpContextHandler = pipelineFactory.getNettyHttpHandler(request.getUri());
         if (nettyHttpContextHandler != null) {
-            handleHttpServletRequest(ctx, e, nettyHttpContextHandler);
+            handleHttpServletRequest(ctx, request, nettyHttpContextHandler);
         } else {
             throw new RuntimeException(
                     "No handler found for uri: " + request.getUri());
         }
-
     }
 
+    
+    @Override
+    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
+        ctx.fireChannelReadComplete();
+    }
+   
     protected void handleHttpServletRequest(ChannelHandlerContext ctx,
-                                            MessageEvent e, NettyHttpContextHandler nettyHttpContextHandler)
+                                            HttpRequest request, NettyHttpContextHandler nettyHttpContextHandler)
         throws Exception {
 
-        interceptOnRequestReceived(ctx, e);
-
-        HttpRequest request = (HttpRequest) e.getMessage();
-        HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
+        interceptOnRequestReceived(ctx, request);
+        
+        FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
 
         NettyServletResponse nettyServletResponse = buildHttpServletResponse(response);
         NettyHttpServletRequest nettyServletRequest = 
             buildHttpServletRequest(request, nettyHttpContextHandler.getContextPath(), ctx);
 
         nettyHttpContextHandler.handle(request.getUri(), nettyServletRequest, nettyServletResponse);
-        interceptOnRequestSuccessed(ctx, e, response);
+        interceptOnRequestSuccessed(ctx, response);
 
         nettyServletResponse.getWriter().flush();
 
@@ -130,16 +139,15 @@ public class NettyHttpServletHandler ext
 
         if (keepAlive) {
             // Add 'Content-Length' header only for a keep-alive connection.
-            response.setHeader(Names.CONTENT_LENGTH, response.getContent()
-                    .readableBytes());
+            response.headers().set(Names.CONTENT_LENGTH, response.content().readableBytes());
             // Add keep alive header as per:
             // -
             // http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01.html#Connection
-            response.setHeader(Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
+            response.headers().set(Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
         }
 
         // write response...
-        ChannelFuture future = e.getChannel().write(response);
+        ChannelFuture future = ctx.write(response);
 
         if (!keepAlive) {
             future.addListener(ChannelFutureListener.CLOSE);
@@ -149,13 +157,13 @@ public class NettyHttpServletHandler ext
 
 
     @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
-        Throwable cause = e.getCause();
+    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
+        
         LOG.log(Level.SEVERE, "Unexpected exception from downstream.", cause);
 
-        interceptOnRequestFailed(ctx, e);
+        interceptOnRequestFailed(ctx, cause);
 
-        Channel ch = e.getChannel();
+        Channel ch = ctx.channel();
         if (cause instanceof IllegalArgumentException) {
 
             ch.close();
@@ -167,7 +175,7 @@ public class NettyHttpServletHandler ext
                 return;
             }
 
-            if (ch.isConnected()) {
+            if (ch.isActive()) {
                 sendError(ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR);
             }
 
@@ -176,37 +184,37 @@ public class NettyHttpServletHandler ext
     }
 
     private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) {
-        HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
-        response.setHeader(Names.CONTENT_TYPE, "text/plain; charset=UTF-8");
-        response.setContent(ChannelBuffers.copiedBuffer("Failure: "
-                + status.toString() + "\r\n", CharsetUtil.UTF_8));
-        ctx.getChannel().write(response).addListener(
-                ChannelFutureListener.CLOSE);
+        ByteBuf content = Unpooled.copiedBuffer("Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8);
+        FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, 
+                                                                status,
+                                                                content);
+        response.headers().set(Names.CONTENT_TYPE, "text/plain; charset=UTF-8");
+        
+        ctx.write(response).addListener(ChannelFutureListener.CLOSE);
     }
 
-    private void interceptOnRequestReceived(ChannelHandlerContext ctx,
-                                            MessageEvent e) {
+    private void interceptOnRequestReceived(ChannelHandlerContext ctx, HttpRequest request) {
 
         if (this.interceptors != null) {
             for (NettyInterceptor interceptor : this.interceptors) {
-                interceptor.onRequestReceived(ctx, e);
+                interceptor.onRequestReceived(ctx, request);
             }
         }
 
     }
 
     private void interceptOnRequestSuccessed(ChannelHandlerContext ctx,
-                                             MessageEvent e, HttpResponse response) {
+                                             HttpResponse response) {
         if (this.interceptors != null) {
             for (NettyInterceptor interceptor : this.interceptors) {
-                interceptor.onRequestSuccessed(ctx, e, response);
+                interceptor.onRequestSuccessed(ctx, response);
             }
         }
 
     }
 
     private void interceptOnRequestFailed(ChannelHandlerContext ctx,
-                                          ExceptionEvent e) {
+                                          Throwable e) {
         if (this.interceptors != null) {
             for (NettyInterceptor interceptor : this.interceptors) {
                 interceptor.onRequestFailed(ctx, e);
@@ -217,6 +225,7 @@ public class NettyHttpServletHandler ext
 
     protected NettyServletResponse buildHttpServletResponse(
             HttpResponse response) {
+        // need to access the 
         return new NettyServletResponse(response);
     }
 

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java Thu Aug 15 14:29:09 2013
@@ -33,26 +33,29 @@ import org.apache.cxf.transport.http.net
 import org.apache.cxf.transport.http.netty.server.session.DefaultHttpSessionStore;
 import org.apache.cxf.transport.http.netty.server.session.HttpSessionStore;
 import org.apache.cxf.transport.https.SSLUtils;
-import org.jboss.netty.channel.ChannelHandler;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.channel.group.DefaultChannelGroup;
-import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
-import org.jboss.netty.handler.codec.http.HttpContentCompressor;
-import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
-import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
-import org.jboss.netty.handler.execution.ExecutionHandler;
-import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
-import org.jboss.netty.handler.ssl.SslHandler;
-import org.jboss.netty.handler.timeout.IdleStateHandler;
 
-public class NettyHttpServletPipelineFactory implements ChannelPipelineFactory {
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.group.ChannelGroup;
+import io.netty.channel.group.DefaultChannelGroup;
+import io.netty.handler.codec.http.HttpContentCompressor;
+import io.netty.handler.codec.http.HttpObjectAggregator;
+import io.netty.handler.codec.http.HttpRequestDecoder;
+import io.netty.handler.codec.http.HttpResponseEncoder;
+import io.netty.handler.ssl.SslHandler;
+import io.netty.handler.timeout.IdleStateHandler;
+import io.netty.util.concurrent.DefaultEventExecutorGroup;
+import io.netty.util.concurrent.EventExecutorGroup;
+import io.netty.util.concurrent.GlobalEventExecutor;
+
+public class NettyHttpServletPipelineFactory extends ChannelInitializer<Channel> {
     private static final Logger LOG =
         LogUtils.getL7dLogger(NettyHttpServletPipelineFactory.class);
     
-    private final ChannelGroup allChannels = new DefaultChannelGroup();
+    //TODO how to manage the allChannels
+    private final ChannelGroup allChannels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);;
 
     private final HttpSessionWatchdog watchdog;
 
@@ -62,8 +65,6 @@ public class NettyHttpServletPipelineFac
     
     private final boolean supportSession;
     
-    private final ExecutionHandler executionHandler;
-
     private final Map<String, NettyHttpContextHandler> handlerMap;
     
     private final int maxChunkContentSize;
@@ -78,9 +79,6 @@ public class NettyHttpServletPipelineFac
         this.handlerMap = handlerMap;
         this.tlsServerParameters = tlsServerParameters;
         this.maxChunkContentSize = maxChunkContentSize;
-        // TODO need to check the if we need pass other setting
-        this.executionHandler = 
-            new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(threadPoolSize, 2048576, 204857600));
     }
 
 
@@ -110,17 +108,9 @@ public class NettyHttpServletPipelineFac
     }
     
     public void shutdown() {
-        this.watchdog.stopWatching();
-        this.allChannels.close().awaitUninterruptibly();
-    }
-
-    @Override
-    public final ChannelPipeline getPipeline() throws Exception {
-        ChannelPipeline pipeline = this.getDefaulHttpChannelPipeline();
-        // need to add another executor handler for invocation the service
-        pipeline.addLast("executionHandler", executionHandler);
-        pipeline.addLast("handler", this.getServletHandler());
-        return pipeline;
+        allChannels.close().awaitUninterruptibly();
+        watchdog.stopWatching();
+        
     }
 
     protected HttpSessionStore getHttpSessionStore() {
@@ -137,10 +127,10 @@ public class NettyHttpServletPipelineFac
         return handler;
     }
 
-    protected ChannelPipeline getDefaulHttpChannelPipeline() throws Exception {
+    protected ChannelPipeline getDefaulHttpChannelPipeline(Channel channel) throws Exception {
 
         // Create a default pipeline implementation.
-        ChannelPipeline pipeline = Channels.pipeline();
+        ChannelPipeline pipeline = channel.pipeline();
         
         SslHandler sslHandler = configureServerSSLOnDemand();
         if (sslHandler != null) {
@@ -151,7 +141,7 @@ public class NettyHttpServletPipelineFac
         }
 
         pipeline.addLast("decoder", new HttpRequestDecoder());
-        pipeline.addLast("aggregator", new HttpChunkAggregator(maxChunkContentSize));
+        pipeline.addLast("aggregator", new HttpObjectAggregator(maxChunkContentSize));
         pipeline.addLast("encoder", new HttpResponseEncoder());
 
         // Remove the following line if you don't want automatic content
@@ -201,4 +191,12 @@ public class NettyHttpServletPipelineFac
 
     }
 
+    @Override
+    protected void initChannel(Channel ch) throws Exception {
+        ChannelPipeline pipeline = getDefaulHttpChannelPipeline(ch);
+        //TODO need to configure the thread size of EventExecutorGroup
+        EventExecutorGroup e1 = new DefaultEventExecutorGroup(16);
+        pipeline.addLast(e1, "handler", this.getServletHandler());
+    }
+
 }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/ChannelInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/ChannelInterceptor.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/ChannelInterceptor.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/ChannelInterceptor.java Thu Aug 15 14:29:09 2013
@@ -21,24 +21,24 @@ package org.apache.cxf.transport.http.ne
 
 import org.apache.cxf.transport.http.netty.server.servlet.ChannelThreadLocal;
 
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.handler.codec.http.HttpResponse;
+import io.netty.channel.ChannelHandlerContext;
+
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
 
 public class ChannelInterceptor implements NettyInterceptor {
     @Override
-    public void onRequestFailed(ChannelHandlerContext ctx, ExceptionEvent e) {
+    public void onRequestFailed(ChannelHandlerContext ctx, Throwable e) {
         ChannelThreadLocal.unset();
     }
 
     @Override
-    public void onRequestReceived(ChannelHandlerContext ctx, MessageEvent e) {
-        ChannelThreadLocal.set(e.getChannel());
+    public void onRequestReceived(ChannelHandlerContext ctx, HttpRequest request) {
+        ChannelThreadLocal.set(ctx.channel());
     }
 
     @Override
-    public void onRequestSuccessed(ChannelHandlerContext ctx, MessageEvent e,
+    public void onRequestSuccessed(ChannelHandlerContext ctx,
                                    HttpResponse response) {
         ChannelThreadLocal.unset();
     }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/HttpSessionInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/HttpSessionInterceptor.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/HttpSessionInterceptor.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/HttpSessionInterceptor.java Thu Aug 15 14:29:09 2013
@@ -25,15 +25,13 @@ import org.apache.cxf.transport.http.net
 import org.apache.cxf.transport.http.netty.server.servlet.NettyHttpSession;
 import org.apache.cxf.transport.http.netty.server.session.HttpSessionStore;
 import org.apache.cxf.transport.http.netty.server.util.Utils;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.handler.codec.http.Cookie;
-import org.jboss.netty.handler.codec.http.CookieEncoder;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpResponse;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.http.ClientCookieEncoder;
+import io.netty.handler.codec.http.Cookie;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpHeaders.Names;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
 
 public class HttpSessionInterceptor implements NettyInterceptor {
     private boolean sessionRequestedByCookie;
@@ -43,11 +41,10 @@ public class HttpSessionInterceptor impl
     }
 
     @Override
-    public void onRequestReceived(ChannelHandlerContext ctx, MessageEvent e) {
+    public void onRequestReceived(ChannelHandlerContext ctx, HttpRequest request) {
 
         HttpSessionThreadLocal.unset();
-
-        HttpRequest request = (HttpRequest) e.getMessage();
+        
         Collection<Cookie> cookies = Utils.getCookies(
                 NettyHttpSession.SESSION_ID_KEY, request);
         if (cookies != null) {
@@ -65,20 +62,20 @@ public class HttpSessionInterceptor impl
     }
 
     @Override
-    public void onRequestSuccessed(ChannelHandlerContext ctx, MessageEvent e,
+    public void onRequestSuccessed(ChannelHandlerContext ctx, 
                                    HttpResponse response) {
 
         NettyHttpSession s = HttpSessionThreadLocal.get();
         if (s != null && !this.sessionRequestedByCookie) {
-            CookieEncoder cookieEncoder = new CookieEncoder(true);
-            cookieEncoder.addCookie(NettyHttpSession.SESSION_ID_KEY, s.getId());
-            HttpHeaders.addHeader(response, Names.SET_COOKIE, cookieEncoder.encode());
+            // setup the Cookie for session
+            HttpHeaders.addHeader(response, Names.SET_COOKIE,  
+                                  ClientCookieEncoder.encode(NettyHttpSession.SESSION_ID_KEY, s.getId()));
         }
 
     }
 
     @Override
-    public void onRequestFailed(ChannelHandlerContext ctx, ExceptionEvent e) {
+    public void onRequestFailed(ChannelHandlerContext ctx, Throwable e) {
         this.sessionRequestedByCookie = false;
         HttpSessionThreadLocal.unset();
     }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/NettyInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/NettyInterceptor.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/NettyInterceptor.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/interceptor/NettyInterceptor.java Thu Aug 15 14:29:09 2013
@@ -19,18 +19,16 @@
 
 package org.apache.cxf.transport.http.netty.server.interceptor;
 
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.handler.codec.http.HttpResponse;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
 
 
 public interface NettyInterceptor {
 
-    void onRequestReceived(ChannelHandlerContext ctx, MessageEvent e);
+    void onRequestReceived(ChannelHandlerContext ctx, HttpRequest request);
 
-    void onRequestSuccessed(ChannelHandlerContext ctx, MessageEvent e,
-                            HttpResponse response);
-
-    void onRequestFailed(ChannelHandlerContext ctx, ExceptionEvent e);
+    void onRequestSuccessed(ChannelHandlerContext ctx, HttpResponse response);
+    
+    void onRequestFailed(ChannelHandlerContext ctx, Throwable cause);
 }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/ChannelThreadLocal.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/ChannelThreadLocal.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/ChannelThreadLocal.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/ChannelThreadLocal.java Thu Aug 15 14:29:09 2013
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.transport.http.netty.server.servlet;
 
-import org.jboss.netty.channel.Channel;
+import io.netty.channel.Channel;
 
 public final class ChannelThreadLocal {
     public static final ThreadLocal<Channel> CHANNEL_THREAD_LOCAL

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpServletRequest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpServletRequest.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpServletRequest.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyHttpServletRequest.java Thu Aug 15 14:29:09 2013
@@ -43,15 +43,16 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpSession;
 
 import org.apache.cxf.transport.http.netty.server.util.Utils;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.http.CookieDecoder;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.QueryStringDecoder;
-import org.jboss.netty.handler.ssl.SslHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.http.CookieDecoder;
+import io.netty.handler.codec.http.HttpContent;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpHeaders.Names;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.QueryStringDecoder;
+import io.netty.handler.ssl.SslHandler;
 
-import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.COOKIE;
+import static io.netty.handler.codec.http.HttpHeaders.Names.COOKIE;
 
 public class NettyHttpServletRequest implements HttpServletRequest {
     
@@ -71,9 +72,7 @@ public class NettyHttpServletRequest imp
     private QueryStringDecoder queryStringDecoder;
 
     private Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
-
-    private CookieDecoder cookieDecoder = new CookieDecoder();
-
+  
     private String characterEncoding;
 
     private String contextPath;
@@ -84,14 +83,14 @@ public class NettyHttpServletRequest imp
         this.originalRequest = request;
         this.contextPath = contextPath;
         this.uriParser = new URIParser(contextPath);
-        this.inputStream = new NettyServletInputStream(request);
+        this.inputStream = new NettyServletInputStream((HttpContent)request);
         this.reader = new BufferedReader(new InputStreamReader(inputStream));
         this.queryStringDecoder = new QueryStringDecoder(request.getUri());
         // setup the SSL security attributes
         this.channelHandlerContext = ctx;
-        SslHandler sslHandler = channelHandlerContext.getPipeline().get(SslHandler.class);
+        SslHandler sslHandler = channelHandlerContext.pipeline().get(SslHandler.class);
         if (sslHandler != null) {
-            SSLSession session = sslHandler.getEngine().getSession();
+            SSLSession session = sslHandler.engine().getSession();
             if (session != null) {
                 attributes.put(SSL_CIPHER_SUITE_ATTRIBUTE, session.getCipherSuite());
                 try {
@@ -114,18 +113,17 @@ public class NettyHttpServletRequest imp
 
     @Override
     public Cookie[] getCookies() {
-        String cookieString = this.originalRequest.getHeader(COOKIE);
+        String cookieString = this.originalRequest.headers().get(COOKIE);
         if (cookieString != null) {
-            Set<org.jboss.netty.handler.codec.http.Cookie> cookies = cookieDecoder
-                    .decode(cookieString);
+            Set<io.netty.handler.codec.http.Cookie> cookies = CookieDecoder.decode(cookieString);
             if (!cookies.isEmpty()) {
                 Cookie[] cookiesArray = new Cookie[cookies.size()];
                 int indx = 0;
-                for (org.jboss.netty.handler.codec.http.Cookie c : cookies) {
+                for (io.netty.handler.codec.http.Cookie c : cookies) {
                     Cookie cookie = new Cookie(c.getName(), c.getValue());
                     cookie.setComment(c.getComment());
                     cookie.setDomain(c.getDomain());
-                    cookie.setMaxAge(c.getMaxAge());
+                    cookie.setMaxAge((int)c.getMaxAge());
                     cookie.setPath(c.getPath());
                     cookie.setSecure(c.isSecure());
                     cookie.setVersion(c.getVersion());
@@ -157,13 +155,13 @@ public class NettyHttpServletRequest imp
     @SuppressWarnings("rawtypes")
     @Override
     public Enumeration getHeaderNames() {
-        return Utils.enumeration(this.originalRequest.getHeaderNames());
+        return Utils.enumeration(this.originalRequest.headers().names());
     }
 
     @SuppressWarnings("rawtypes")
     @Override
     public Enumeration getHeaders(String name) {
-        return Utils.enumeration(this.originalRequest.getHeaders(name));
+        return Utils.enumeration(this.originalRequest.headers().getAll(name));
     }
 
     @Override
@@ -173,7 +171,7 @@ public class NettyHttpServletRequest imp
 
     @Override
     public String getMethod() {
-        return this.originalRequest.getMethod().getName();
+        return this.originalRequest.getMethod().name();
     }
 
     @Override
@@ -240,19 +238,18 @@ public class NettyHttpServletRequest imp
     @SuppressWarnings("rawtypes")
     @Override
     public Map getParameterMap() {
-        return this.queryStringDecoder.getParameters();
+        return this.queryStringDecoder.parameters();
     }
 
     @SuppressWarnings("rawtypes")
     @Override
     public Enumeration getParameterNames() {
-        return Utils.enumerationFromKeys(this.queryStringDecoder
-                .getParameters());
+        return Utils.enumerationFromKeys(this.queryStringDecoder.parameters());
     }
 
     @Override
     public String[] getParameterValues(String name) {
-        List<String> values = this.queryStringDecoder.getParameters().get(name);
+        List<String> values = this.queryStringDecoder.parameters().get(name);
         if (values == null || values.isEmpty()) {
             return null;
         }
@@ -327,36 +324,31 @@ public class NettyHttpServletRequest imp
 
     @Override
     public String getRemoteAddr() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getRemoteAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().remoteAddress();
         return addr.getAddress().getHostAddress();
     }
 
     @Override
     public String getRemoteHost() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getRemoteAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().remoteAddress();
         return addr.getHostName();
     }
 
     @Override
     public int getRemotePort() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getRemoteAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().remoteAddress();
         return addr.getPort();
     }
 
     @Override
     public String getServerName() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getLocalAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().localAddress();
         return addr.getHostName();
     }
 
     @Override
     public int getServerPort() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getLocalAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().localAddress();
         return addr.getPort();
     }
 
@@ -376,7 +368,7 @@ public class NettyHttpServletRequest imp
 
     @Override
     public boolean isSecure() {
-        return ChannelThreadLocal.get().getPipeline().get(SslHandler.class) != null;
+        return ChannelThreadLocal.get().pipeline().get(SslHandler.class) != null;
     }
 
     @Override
@@ -386,8 +378,7 @@ public class NettyHttpServletRequest imp
 
     @Override
     public String getLocalAddr() {
-        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get()
-                .getLocalAddress();
+        InetSocketAddress addr = (InetSocketAddress) ChannelThreadLocal.get().localAddress();
         return addr.getAddress().getHostAddress();
     }
 

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java Thu Aug 15 14:29:09 2013
@@ -19,21 +19,20 @@
 
 package org.apache.cxf.transport.http.netty.server.servlet;
 
-
 import java.io.IOException;
+
 import javax.servlet.ServletInputStream;
-import org.jboss.netty.buffer.ChannelBufferInputStream;
-import org.jboss.netty.handler.codec.http.HttpRequest;
 
-public class NettyServletInputStream extends ServletInputStream {
+import io.netty.buffer.ByteBufInputStream;
+import io.netty.handler.codec.http.HttpContent;
 
-    private final HttpRequest request;
 
-    private final ChannelBufferInputStream in;
+public class NettyServletInputStream extends ServletInputStream {
+
+    private final ByteBufInputStream in;
 
-    public NettyServletInputStream(HttpRequest request) {
-        this.request = request;
-        this.in = new ChannelBufferInputStream(this.request.getContent());
+    public NettyServletInputStream(HttpContent httpContent) {
+        this.in = new ByteBufInputStream(httpContent.content());
     }
 
     @Override
@@ -50,4 +49,5 @@ public class NettyServletInputStream ext
     public int read(byte[] buf, int offset, int len) throws IOException {
         return this.in.read(buf, offset, len);
     }
+    
 }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletOutputStream.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletOutputStream.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletOutputStream.java Thu Aug 15 14:29:09 2013
@@ -20,21 +20,20 @@
 package org.apache.cxf.transport.http.netty.server.servlet;
 
 import java.io.IOException;
+
 import javax.servlet.ServletOutputStream;
-import org.jboss.netty.buffer.ChannelBufferOutputStream;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.handler.codec.http.HttpResponse;
 
-public class NettyServletOutputStream extends ServletOutputStream {
-    private HttpResponse response;
+import io.netty.buffer.ByteBufOutputStream;
+import io.netty.handler.codec.http.HttpContent;
 
-    private ChannelBufferOutputStream out;
+public class NettyServletOutputStream extends ServletOutputStream {
+    
+    private ByteBufOutputStream out;
 
     private boolean flushed;
 
-    public NettyServletOutputStream(HttpResponse response) {
-        this.response = response;
-        this.out = new ChannelBufferOutputStream(ChannelBuffers.dynamicBuffer());
+    public NettyServletOutputStream(HttpContent httpContent) {
+        this.out = new ByteBufOutputStream(httpContent.content());
     }
 
     @Override
@@ -54,7 +53,7 @@ public class NettyServletOutputStream ex
 
     @Override
     public void flush() throws IOException {
-        this.response.setContent(out.buffer());
+        out.flush();
         this.flushed = true;
     }
 
@@ -69,4 +68,6 @@ public class NettyServletOutputStream ex
     public int getBufferSize() {
         return this.out.buffer().capacity();
     }
+    
+    
 }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletResponse.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletResponse.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletResponse.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletResponse.java Thu Aug 15 14:29:09 2013
@@ -28,14 +28,15 @@ import java.util.Locale;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 
-import org.jboss.netty.handler.codec.http.Cookie;
-import org.jboss.netty.handler.codec.http.CookieEncoder;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpResponse;
-import org.jboss.netty.handler.codec.http.HttpResponseStatus;
+import io.netty.handler.codec.http.ClientCookieEncoder;
+import io.netty.handler.codec.http.Cookie;
+import io.netty.handler.codec.http.HttpContent;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.HttpResponseStatus;
 
-import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.LOCATION;
-import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.SET_COOKIE;
+import static io.netty.handler.codec.http.HttpHeaders.Names.LOCATION;
+import static io.netty.handler.codec.http.HttpHeaders.Names.SET_COOKIE;
 
 
 public class NettyServletResponse implements HttpServletResponse {
@@ -50,7 +51,7 @@ public class NettyServletResponse implem
 
     public NettyServletResponse(HttpResponse response) {
         this.originalResponse = response;
-        this.outputStream = new NettyServletOutputStream(response);
+        this.outputStream = new NettyServletOutputStream((HttpContent)response);
         this.writer = new PrintWriter(this.outputStream);
     }
 
@@ -59,10 +60,9 @@ public class NettyServletResponse implem
     }
 
     public void addCookie(Cookie cookie) {
-        CookieEncoder cookieEncoder = new CookieEncoder(true);
-        cookieEncoder.addCookie(cookie.getName(), cookie.getValue());
-        HttpHeaders.addHeader(this.originalResponse, SET_COOKIE, cookieEncoder
-                .encode());
+        HttpHeaders.addHeader(this.originalResponse, 
+                              SET_COOKIE, 
+                              ClientCookieEncoder.encode(cookie.getName(), cookie.getValue()));
     }
 
     public void addDateHeader(String name, long date) {
@@ -83,7 +83,7 @@ public class NettyServletResponse implem
     }
 
     public boolean containsHeader(String name) {
-        return this.originalResponse.containsHeader(name);
+        return this.originalResponse.headers().contains(name);
     }
 
     public void sendError(int sc) throws IOException {
@@ -153,7 +153,7 @@ public class NettyServletResponse implem
             throw new IllegalStateException("Response already commited!");
         }
 
-        this.originalResponse.clearHeaders();
+        this.originalResponse.headers().clear();
         this.resetBuffer();
     }
 

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/util/Utils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/util/Utils.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/util/Utils.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/util/Utils.java Thu Aug 15 14:29:09 2013
@@ -33,12 +33,12 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-import org.jboss.netty.handler.codec.http.Cookie;
-import org.jboss.netty.handler.codec.http.CookieDecoder;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.Cookie;
+import io.netty.handler.codec.http.CookieDecoder;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
 
-import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.COOKIE;
+import static io.netty.handler.codec.http.HttpHeaders.Names.COOKIE;
 
 
 public final class Utils {
@@ -104,11 +104,10 @@ public final class Utils {
 
     public static Collection<Cookie> getCookies(String name,
                                                       HttpRequest request) {
-        String cookieString = request.getHeader(COOKIE);
+        String cookieString = request.headers().get(COOKIE);
         if (cookieString != null) {
             List<Cookie> foundCookie = new ArrayList<Cookie>();
-            CookieDecoder cookieDecoder = new CookieDecoder();
-            Set<Cookie> cookies = cookieDecoder.decode(cookieString);
+            Set<Cookie> cookies = CookieDecoder.decode(cookieString);
             for (Cookie cookie : cookies) {
                 if (cookie.getName().equals(name)) {
                     foundCookie.add(cookie);
@@ -122,11 +121,10 @@ public final class Utils {
 
     public static Collection<Cookie> getCookies(String name,
                                                 HttpResponse response) {
-        String cookieString = response.getHeader(COOKIE);
+        String cookieString = response.headers().get(COOKIE);
         if (cookieString != null) {
             List<Cookie> foundCookie = new ArrayList<Cookie>();
-            CookieDecoder cookieDecoder = new CookieDecoder();
-            Set<Cookie> cookies = cookieDecoder.decode(cookieString);
+            Set<Cookie> cookies = CookieDecoder.decode(cookieString);
             for (Cookie cookie : cookies) {
                 if (cookie.getName().equals(name)) {
                     foundCookie.add(cookie);

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java?rev=1514292&r1=1514291&r2=1514292&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java Thu Aug 15 14:29:09 2013
@@ -33,6 +33,7 @@ import org.apache.cxf.greeter_control.ty
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 



Mime
View raw message