You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2013/06/25 04:56:56 UTC

svn commit: r1496341 - in /cxf/trunk/rt/transports/http-netty/netty-server: ./ src/main/java/org/apache/cxf/transport/http/netty/server/ src/main/java/org/apache/cxf/transport/http/netty/server/spring/ src/main/resources/META-INF/ src/main/resources/sc...

Author: ningjiang
Date: Tue Jun 25 02:56:55 2013
New Revision: 1496341

URL: http://svn.apache.org/r1496341
Log:
CXF-5043 add the spring configuration support of netty-server

Added:
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NamespaceHandler.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineBeanDefinitionParser.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineFactoryBeanDefinitionParser.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettySpringTypesFactory.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.handlers
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.schemas
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/
    cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/http-netty-server.xsd
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/ApplicationContextTest.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/bean.properties
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans.xml
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/serverenginefactory.xml
Modified:
    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/NettyHttpServerEngineFactory.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/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineTest.java
    cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java

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=1496341&r1=1496340&r2=1496341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/pom.xml (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/pom.xml Tue Jun 25 02:56:55 2013
@@ -62,6 +62,22 @@
             <artifactId>geronimo-servlet_2.5_spec</artifactId>
             <version>1.1.2</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <optional>true</optional>
+        </dependency>
 
         <!-- testing -->
         <dependency>
@@ -92,19 +108,35 @@
     </dependencies>
 
     <build>
-        <defaultGoal>install</defaultGoal>
-
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.4</version>
-                <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                </configuration>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-xjc-plugin</artifactId>
+                <version>${cxf.xjc-utils.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+                            <xsdOptions>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/configuration/http-netty-server.xsd</xsd>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                    <deleteDirs>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/configuration/security</deleteDir>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/transports/http/configuration</deleteDir>
+                                    </deleteDirs>
+                                </xsdOption>
+                            </xsdOptions>
+                        </configuration>
+                        <goals>
+                            <goal>xsdtojava</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
-
         </plugins>
     </build>
 

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=1496341&r1=1496340&r2=1496341&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 Tue Jun 25 02:56:55 2013
@@ -25,11 +25,16 @@ 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;
 
 public class NettyHttpServerEngine implements ServerEngine {
 
@@ -52,6 +57,8 @@ public class NettyHttpServerEngine imple
     private volatile Channel serverChannel;
 
     private NettyHttpServletPipelineFactory servletPipeline;
+    
+    private Timer timer = new HashedWheelTimer();
 
     private Map<String, NettyHttpContextHandler> handlerMap = new ConcurrentHashMap<String, NettyHttpContextHandler>();
     
@@ -62,6 +69,15 @@ public class NettyHttpServerEngine imple
      */
     private TLSServerParameters tlsServerParameters;
     
+    private int readIdleTime = 60;
+    
+    private int writeIdleTime = 30;
+    
+    private boolean sessionSupport;
+    
+    public NettyHttpServerEngine() {
+        
+    }
 
     public NettyHttpServerEngine(
             String host,
@@ -78,6 +94,11 @@ public class NettyHttpServerEngine imple
         this.protocol = protocol;
     }
     
+    @PostConstruct
+    public void finalizeConfig() {
+        // need to check if we need to any other thing other than Setting the TLSServerParameter
+    }
+    
     
     /**
      * This method is used to programmatically set the TLSServerParameters.
@@ -85,9 +106,7 @@ public class NettyHttpServerEngine imple
      * @throws IOException 
      */
     public void setTlsServerParameters(TLSServerParameters params) {
-        
         tlsServerParameters = params;
-        
     }
     
     /**
@@ -98,17 +117,22 @@ public class NettyHttpServerEngine imple
      */
     public TLSServerParameters getTlsServerParameters() {
         return tlsServerParameters;
-    } 
-    
-   
+    }
+      
     protected Channel startServer() {
         // TODO Configure the server.
         final ServerBootstrap bootstrap = new ServerBootstrap(
                 new NioServerSocketChannelFactory(Executors
                         .newCachedThreadPool(), Executors.newCachedThreadPool()));
-
+        // Set up the idle handler
+        IdleStateHandler idleStateHandler = 
+            new IdleStateHandler(this.timer, getReadIdleTime(), getWriteIdleTime(), 0);
         // Set up the event pipeline factory.
-        servletPipeline = new NettyHttpServletPipelineFactory(tlsServerParameters, handlerMap);
+        servletPipeline = 
+            new NettyHttpServletPipelineFactory(
+                 tlsServerParameters, sessionSupport, port, handlerMap, idleStateHandler);
+        // Start the servletPipeline's timer
+        servletPipeline.start();
         bootstrap.setPipelineFactory(servletPipeline);
         InetSocketAddress address = null;
         if (host == null) {
@@ -163,6 +187,8 @@ public class NettyHttpServerEngine imple
     }
 
     public void shutdown() {
+        // stop the timer
+        timer.stop();
         // just unbind the channel
         if (serverChannel != null) {
             serverChannel.close();
@@ -171,4 +197,36 @@ public class NettyHttpServerEngine imple
             servletPipeline.shutdown();
         }
     }
+
+    public int getReadIdleTime() {
+        return readIdleTime;
+    }
+
+    public void setReadIdleTime(int readIdleTime) {
+        this.readIdleTime = readIdleTime;
+    }
+
+    public int getWriteIdleTime() {
+        return writeIdleTime;
+    }
+
+    public void setWriteIdleTime(int writeIdleTime) {
+        this.writeIdleTime = writeIdleTime;
+    }
+
+    public boolean isSessionSupport() {
+        return sessionSupport;
+    }
+
+    public void setSessionSupport(boolean session) {
+        this.sessionSupport = session;
+    }
+    
+    public int getPort() {
+        return port;
+    }
+    
+    public void setPort(int port) {
+        this.port = port;
+    }
 }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineFactory.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/NettyHttpServerEngineFactory.java?rev=1496341&r1=1496340&r2=1496341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineFactory.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineFactory.java Tue Jun 25 02:56:55 2013
@@ -21,13 +21,20 @@ package org.apache.cxf.transport.http.ne
 
 
 import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
+
 import javax.annotation.Resource;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.buslifecycle.BusLifeCycleListener;
 import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+
 
 public class NettyHttpServerEngineFactory implements BusLifeCycleListener {
     private static final Logger LOG =
@@ -39,14 +46,22 @@ public class NettyHttpServerEngineFactor
     private Bus bus;
 
     private BusLifeCycleManager lifeCycleManager;
+    
+    private Map<String, TLSServerParameters> tlsServerParametersMap = 
+        new TreeMap<String, TLSServerParameters>();
 
     public NettyHttpServerEngineFactory() {
         // Empty
     }
-
+    
     public NettyHttpServerEngineFactory(Bus b) {
         setBus(b);
     }
+    
+    public NettyHttpServerEngineFactory(Bus b, Map<String, TLSServerParameters> tls) {
+        setBus(b);
+        tlsServerParametersMap = tls;
+    }
 
     public Bus getBus() {
         return bus;
@@ -69,6 +84,24 @@ public class NettyHttpServerEngineFactor
             }
         }
     }
+    
+    public Map<String, TLSServerParameters> getTlsServerParametersMap() {
+        return tlsServerParametersMap;
+    }
+
+    public void setTlsServerParameters(Map<String, TLSServerParameters> tlsParametersMap) {
+        this.tlsServerParametersMap = tlsParametersMap;
+    }
+    
+    public void setEnginesList(List<NettyHttpServerEngine> enginesList) {
+        for (NettyHttpServerEngine engine : enginesList) {
+            /*if (engine.getPort() == FALLBACK_THREADING_PARAMS_KEY) {
+                fallbackThreadingParameters = engine.getThreadingParameters();
+            }*/
+            portMap.putIfAbsent(engine.getPort(), engine);
+        }    
+    }
+    
 
     public void initComplete() {
         // do nothing here
@@ -82,6 +115,7 @@ public class NettyHttpServerEngineFactor
         for (NettyHttpServerEngine engine : engines) {
             engine.shutdown();
         }
+        tlsServerParametersMap.clear();
     }
 
     public void preShutdown() {
@@ -91,15 +125,18 @@ public class NettyHttpServerEngineFactor
 
     private static NettyHttpServerEngine getOrCreate(NettyHttpServerEngineFactory factory,
                                                      String host,
-                                                     int port
-    ) throws IOException {
+                                                     int port,
+                                                     TLSServerParameters tlsParams
+                                                     ) throws IOException {
 
         NettyHttpServerEngine ref = portMap.get(port);
         if (ref == null) {
             ref = new NettyHttpServerEngine(host, port);
-
+            if (tlsParams != null) {
+                ref.setTlsServerParameters(tlsParams);
+            }
+            ref.finalizeConfig();
             NettyHttpServerEngine tmpRef = portMap.putIfAbsent(port, ref);
-
             if (tmpRef != null) {
                 ref = tmpRef;
             }
@@ -115,8 +152,12 @@ public class NettyHttpServerEngineFactor
 
     public synchronized NettyHttpServerEngine createNettyHttpServerEngine(String host, int port,
                                                                           String protocol) throws IOException {
-        LOG.fine("Creating Jetty HTTP Server Engine for port " + port + ".");
-        NettyHttpServerEngine ref = getOrCreate(this, host, port);
+        LOG.fine("Creating Netty HTTP Server Engine for port " + port + ".");
+        TLSServerParameters tlsServerParameters = null;
+        if (protocol.equals("https") && tlsServerParametersMap != null) {
+            tlsServerParameters = tlsServerParametersMap.get(port);
+        }
+        NettyHttpServerEngine ref = getOrCreate(this, host, port, tlsServerParameters);
         // checking the protocol
         if (!protocol.equals(ref.getProtocol())) {
             throw new IOException("Protocol mismatch for port " + port + ": "
@@ -148,4 +189,6 @@ public class NettyHttpServerEngineFactor
             }
         }
     }
+
+   
 }

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=1496341&r1=1496340&r2=1496341&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 Tue Jun 25 02:56:55 2013
@@ -47,8 +47,6 @@ import org.jboss.netty.handler.execution
 import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
 import org.jboss.netty.handler.ssl.SslHandler;
 import org.jboss.netty.handler.timeout.IdleStateHandler;
-import org.jboss.netty.util.HashedWheelTimer;
-import org.jboss.netty.util.Timer;
 
 public class NettyHttpServletPipelineFactory implements ChannelPipelineFactory {
     private static final Logger LOG =
@@ -59,26 +57,25 @@ public class NettyHttpServletPipelineFac
     private final HttpSessionWatchdog watchdog;
 
     private final ChannelHandler idleStateHandler;
-
-    private final Timer timer;
     
     private final TLSServerParameters tlsServerParameters;
-
-    // TODO we may need to configure the thread pool from outside
-    private final ExecutionHandler executionHandler =
-            new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(200, 2048576, 204857600));
+    
+    private final boolean supportSession;
+    
+    private final ExecutionHandler executionHandler;
 
     private final Map<String, NettyHttpContextHandler> handlerMap;
 
-    public NettyHttpServletPipelineFactory(TLSServerParameters tlsServerParameters,
-                                           Map<String, NettyHttpContextHandler> handlerMap) {
-
-        this.timer = new HashedWheelTimer();
-        this.idleStateHandler = new IdleStateHandler(this.timer, 60, 30, 0);
+    public NettyHttpServletPipelineFactory(TLSServerParameters tlsServerParameters, 
+                                           boolean supportSession, int threadPoolSize,
+                                           Map<String, NettyHttpContextHandler> handlerMap,
+                                           IdleStateHandler idleStateHandler) {
+        this.supportSession = supportSession;
+        this.idleStateHandler = idleStateHandler;
         this.watchdog = new HttpSessionWatchdog();
         this.handlerMap = handlerMap;
         this.tlsServerParameters = tlsServerParameters;
-        new Thread(watchdog).start();
+        this.executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(200, 2048576, 204857600));
     }
 
 
@@ -101,9 +98,14 @@ public class NettyHttpServletPipelineFac
         return null;
     }
     
+    public void start() {
+        if (supportSession) {
+            new Thread(watchdog).start();
+        }
+    }
+    
     public void shutdown() {
         this.watchdog.stopWatching();
-        this.timer.stop();
         this.allChannels.close().awaitUninterruptibly();
     }
 
@@ -124,7 +126,9 @@ public class NettyHttpServletPipelineFac
 
         NettyHttpServletHandler handler = new NettyHttpServletHandler(this);
         handler.addInterceptor(new ChannelInterceptor());
-        handler.addInterceptor(new HttpSessionInterceptor(getHttpSessionStore()));
+        if (supportSession) {
+            handler.addInterceptor(new HttpSessionInterceptor(getHttpSessionStore()));
+        }
         return handler;
     }
 

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NamespaceHandler.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/spring/NamespaceHandler.java?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NamespaceHandler.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NamespaceHandler.java Tue Jun 25 02:56:55 2013
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.netty.server.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+    public void init() {
+        registerBeanDefinitionParser("engine-factory", 
+                new NettyHttpServerEngineFactoryBeanDefinitionParser());
+        registerBeanDefinitionParser("engine",
+                                     new NettyHttpServerEngineBeanDefinitionParser());
+    }
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineBeanDefinitionParser.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/spring/NettyHttpServerEngineBeanDefinitionParser.java?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineBeanDefinitionParser.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineBeanDefinitionParser.java Tue Jun 25 02:56:55 2013
@@ -0,0 +1,285 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.netty.server.spring;
+
+
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import javax.annotation.PostConstruct;
+import javax.xml.bind.JAXBContext;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.jsse.TLSServerParametersConfig;
+import org.apache.cxf.configuration.security.CertificateConstraintsType;
+import org.apache.cxf.configuration.security.CipherSuites;
+import org.apache.cxf.configuration.security.ClientAuthentication;
+import org.apache.cxf.configuration.security.FiltersType;
+import org.apache.cxf.configuration.security.KeyManagersType;
+import org.apache.cxf.configuration.security.SecureRandomParameters;
+import org.apache.cxf.configuration.security.TLSServerParametersType;
+import org.apache.cxf.configuration.security.TrustManagersType;
+import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngine;
+import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngineFactory;
+import org.apache.cxf.transports.http_netty_server.configuration.TLSServerParametersIdentifiedType;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+
+public class NettyHttpServerEngineBeanDefinitionParser extends AbstractBeanDefinitionParser {
+    private static final String SECURITY_NS =
+        "http://cxf.apache.org/configuration/security";
+
+    public void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        
+        String portStr = element.getAttribute("port");
+        bean.addPropertyValue("port", portStr);
+        
+        String hostStr = element.getAttribute("host");
+        if (hostStr != null && !"".equals(hostStr.trim())) {
+            bean.addPropertyValue("host", hostStr);
+        }
+
+        String continuationsStr = element.getAttribute("continuationsEnabled");
+        if (continuationsStr != null && continuationsStr.length() > 0) {
+            bean.addPropertyValue("continuationsEnabled", continuationsStr);
+        }
+        
+        String maxIdleTimeStr = element.getAttribute("maxIdleTime");
+        if (maxIdleTimeStr != null && !"".equals(maxIdleTimeStr.trim())) {
+            bean.addPropertyValue("maxIdleTime", maxIdleTimeStr);
+        }
+        
+        String sendServerVersionStr = element.getAttribute("sendServerVersion");
+        if (sendServerVersionStr != null && sendServerVersionStr.length() > 0) {
+            bean.addPropertyValue("sendServerVersion", sendServerVersionStr);
+        }
+        
+        ValueHolder busValue = ctx.getContainingBeanDefinition()
+            .getConstructorArgumentValues().getArgumentValue(0, Bus.class);
+        bean.addPropertyValue("bus", busValue.getValue());
+        try {
+            Element elem = DOMUtils.getFirstElement(element);
+            while (elem != null) {
+                String name = elem.getLocalName();
+                if ("tlsServerParameters".equals(name)) {
+                    mapTLSServerParameters(elem, bean);
+                } else if ("tlsServerParametersRef".equals(name)) {
+                    mapElementToJaxbPropertyFactory(elem,
+                                                    bean,
+                                                    "tlsServerParametersRef",
+                                                    TLSServerParametersIdentifiedType.class,
+                                                    NettyHttpServerEngineBeanDefinitionParser.class,
+                                                    "createTLSServerParametersConfigRef");
+                } else if ("sessionSupport".equals(name) || "reuseAddress".equals(name)) {
+                    String text = elem.getTextContent();                        
+                    bean.addPropertyValue(name, text);
+                }                         
+
+                elem = org.apache.cxf.helpers.DOMUtils.getNextElement(elem);          
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("Could not process configuration.", e);
+        }
+
+        bean.setLazyInit(false);
+    }
+    
+    private void mapTLSServerParameters(Element e, BeanDefinitionBuilder bean) {
+        BeanDefinitionBuilder paramsbean 
+            = BeanDefinitionBuilder.rootBeanDefinition(TLSServerParametersConfig.TLSServerParametersTypeInternal.class);
+        
+        // read the attributes
+        NamedNodeMap as = e.getAttributes();
+        for (int i = 0; i < as.getLength(); i++) {
+            Attr a = (Attr) as.item(i);
+            if (a.getNamespaceURI() == null) {
+                String aname = a.getLocalName();
+                if ("jsseProvider".equals(aname) 
+                    || "secureSocketProtocol".equals(aname)) {
+                    paramsbean.addPropertyValue(aname, a.getValue());
+                }
+            }
+        }
+        
+        // read the child elements
+        Node n = e.getFirstChild();
+        while (n != null) {
+            if (Node.ELEMENT_NODE != n.getNodeType() 
+                || !SECURITY_NS.equals(n.getNamespaceURI())) {
+                n = n.getNextSibling();
+                continue;
+            }
+            String ename = n.getLocalName();
+            // Schema should require that no more than one each of these exist.
+            String ref = ((Element)n).getAttribute("ref");
+
+            if ("keyManagers".equals(ename)) {
+                if (ref != null && ref.length() > 0) {
+                    paramsbean.addPropertyReference("keyManagersRef", ref);
+                } else {
+                    mapElementToJaxbProperty((Element)n, paramsbean, ename, 
+                                             KeyManagersType.class);
+                }
+            } else if ("trustManagers".equals(ename)) {
+                if (ref != null && ref.length() > 0) {
+                    paramsbean.addPropertyReference("trustManagersRef", ref);
+                } else {
+                    mapElementToJaxbProperty((Element)n, paramsbean, ename, 
+                                             TrustManagersType.class);
+                }
+            } else if ("cipherSuites".equals(ename)) {
+                mapElementToJaxbProperty((Element)n, paramsbean, ename,
+                                         CipherSuites.class);
+            } else if ("cipherSuitesFilter".equals(ename)) {
+                mapElementToJaxbProperty((Element)n, paramsbean, ename,
+                                         FiltersType.class);
+            } else if ("secureRandomParameters".equals(ename)) {
+                mapElementToJaxbProperty((Element)n, paramsbean, ename,
+                                         SecureRandomParameters.class);
+            } else if ("clientAuthentication".equals(ename)) {
+                mapElementToJaxbProperty((Element)n, paramsbean, ename,
+                                         ClientAuthentication.class);
+            } else if ("certConstraints".equals(ename)) {
+                mapElementToJaxbProperty((Element)n, paramsbean, ename,
+                                         CertificateConstraintsType.class);
+            } else if ("certAlias".equals(ename)) {
+                paramsbean.addPropertyValue(ename, n.getTextContent());
+            }
+            n = n.getNextSibling();
+        }
+
+        BeanDefinitionBuilder jaxbbean 
+            = BeanDefinitionBuilder.rootBeanDefinition(TLSServerParametersConfig.class);
+        jaxbbean.addConstructorArgValue(paramsbean.getBeanDefinition());
+        bean.addPropertyValue("tlsServerParameters", jaxbbean.getBeanDefinition());
+    }
+
+    
+       
+    /*
+     * We do not require an id from the configuration.
+     * 
+     * (non-Javadoc)
+     * @see org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#shouldGenerateId()
+     */
+    @Override
+    protected boolean shouldGenerateId() {
+        return true;
+    }
+
+    @Override
+    protected Class<?> getBeanClass(Element arg0) {
+        return SpringNettyHttpServerEngine.class;
+    }
+    
+    @NoJSR250Annotations
+    public static class SpringNettyHttpServerEngine extends NettyHttpServerEngine
+        implements ApplicationContextAware, InitializingBean {
+        
+        String threadingRef;
+        String tlsRef;
+        Bus bus;
+        NettyHttpServerEngineFactory factory;
+        
+        public SpringNettyHttpServerEngine(
+            NettyHttpServerEngineFactory fac,
+            Bus b,
+            String host,
+            int port) {
+            super(host, port);
+            bus = b;
+            factory = fac;
+        }
+        
+        public SpringNettyHttpServerEngine() {
+            super();
+        }
+        
+        public void setBus(Bus b) {
+            bus = b;
+            if (null != bus && null == factory) {
+                factory = bus.getExtension(NettyHttpServerEngineFactory.class);
+            } 
+        }
+        
+        public void setApplicationContext(ApplicationContext ctx) throws BeansException {
+            if (bus == null) {
+                bus = BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx);
+            }
+        }
+        
+        public void setThreadingParametersRef(String s) {
+            threadingRef = s;
+        }
+        public void setTlsServerParametersRef(String s) {
+            tlsRef = s;
+        }
+        
+        @PostConstruct
+        public void finalizeConfig() {
+            if (tlsRef != null) {
+                setTlsServerParameters(factory.getTlsServerParametersMap().get(tlsRef));
+            }
+            super.finalizeConfig();
+        }
+
+        public void afterPropertiesSet() throws Exception {
+            finalizeConfig();
+        }
+
+    }
+    
+    public static TLSServerParametersConfig createTLSServerParametersConfig(String s, 
+                                                                            JAXBContext context) 
+        throws GeneralSecurityException, IOException {
+        
+        TLSServerParametersType parametersType = unmarshalFactoryString(s, context,
+                                                                        TLSServerParametersType.class);
+        
+        return new TLSServerParametersConfig(parametersType);
+    }
+    
+    public static String createTLSServerParametersConfigRef(String s, JAXBContext context)
+    
+        throws GeneralSecurityException, IOException {
+        
+        TLSServerParametersIdentifiedType parameterTypeRef 
+            = unmarshalFactoryString(s, context, TLSServerParametersIdentifiedType.class);
+        
+        return parameterTypeRef.getId(); 
+    } 
+   
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineFactoryBeanDefinitionParser.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/spring/NettyHttpServerEngineFactoryBeanDefinitionParser.java?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineFactoryBeanDefinitionParser.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettyHttpServerEngineFactoryBeanDefinitionParser.java Tue Jun 25 02:56:55 2013
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.netty.server.spring;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.configuration.spring.BusWiringType;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngineFactory;
+import org.apache.cxf.transports.http_netty_server.configuration.TLSServerParametersIdentifiedType;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class NettyHttpServerEngineFactoryBeanDefinitionParser
+        extends AbstractBeanDefinitionParser {
+    static final String HTTP_NETTY_SERVER_NS = "http://cxf.apache.org/transports/http-netty-server/configuration";
+
+    protected String resolveId(Element elem, AbstractBeanDefinition definition, 
+                               ParserContext ctx) throws BeanDefinitionStoreException {
+        String id = this.getIdOrName(elem);
+        if (StringUtils.isEmpty(id)) {
+            return NettyHttpServerEngineFactory.class.getName();            
+        }
+        id = super.resolveId(elem, definition, ctx);
+        if (!ctx.getRegistry().containsBeanDefinition(NettyHttpServerEngineFactory.class.getName())) {
+            ctx.getRegistry().registerAlias(id, NettyHttpServerEngineFactory.class.getName());
+        }
+        return id;
+    }
+    
+
+    @Override
+    public void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        //bean.setAbstract(true);        
+        String bus = element.getAttribute("bus");
+        
+        BeanDefinitionBuilder factbean 
+            = BeanDefinitionBuilder
+                .rootBeanDefinition(NettySpringTypesFactory.class);
+
+        ctx.getRegistry()
+            .registerBeanDefinition(NettySpringTypesFactory.class.getName(),
+                                    factbean.getBeanDefinition());
+        try {
+            if (StringUtils.isEmpty(bus)) {
+                addBusWiringAttribute(bean, BusWiringType.CONSTRUCTOR);
+            } else {
+                bean.addConstructorArgReference(bus);
+            }
+
+            bean.addConstructorArgValue(mapElementToJaxbBean(element,
+                                                        TLSServerParametersIdentifiedType.class,
+                                                        NettySpringTypesFactory.class,
+                                                        "createTLSServerParametersMap"));
+            
+            // parser the engine list
+            List<Object> list = 
+                getRequiredElementsList(element, ctx, new QName(HTTP_NETTY_SERVER_NS, "engine"), bean);
+            if (list.size() > 0) {
+                bean.addPropertyValue("enginesList", list);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("Could not process configuration.", e);
+        }
+    }    
+    
+    private List<Object> getRequiredElementsList(Element parent, ParserContext ctx, QName name,
+                                         BeanDefinitionBuilder bean) {
+       
+        List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(parent, 
+                                                                     name.getNamespaceURI(), 
+                                                                     name.getLocalPart());
+        ManagedList<Object> list = new ManagedList<Object>(elemList.size());
+        list.setSource(ctx.extractSource(parent));
+        
+        for (Element elem : elemList) {
+            list.add(ctx.getDelegate().parsePropertySubElement(elem, bean.getBeanDefinition()));
+        }
+        return list;
+    }
+    
+    
+          
+    /*
+     * We do not require an id from the configuration.
+     * 
+     * (non-Javadoc)
+     * @see org.springframework.beans.factory.xml.AbstractBeanDefinitionParser#shouldGenerateId()
+     */
+    @Override
+    protected boolean shouldGenerateId() {
+        return true;
+    }
+
+    @Override
+    protected Class<?> getBeanClass(Element arg0) {
+        return SpringNettyHttpServerEngineFactory.class;
+    }
+    
+    @NoJSR250Annotations(unlessNull = "bus")
+    public static class SpringNettyHttpServerEngineFactory extends NettyHttpServerEngineFactory 
+        implements ApplicationContextAware {
+
+        public SpringNettyHttpServerEngineFactory() {
+            super();
+        }
+        public SpringNettyHttpServerEngineFactory(Bus bus,
+                                                  Map<String, TLSServerParameters> tls) {
+            super(bus, tls);
+        }   
+        
+        public void setApplicationContext(ApplicationContext ctx) throws BeansException {
+            if (getBus() == null) {
+                setBus(BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx));
+            }
+        }
+    }
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettySpringTypesFactory.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/spring/NettySpringTypesFactory.java?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettySpringTypesFactory.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/spring/NettySpringTypesFactory.java Tue Jun 25 02:56:55 2013
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.netty.server.spring;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.configuration.jsse.TLSServerParametersConfig;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.transports.http_netty_server.configuration.TLSServerParametersIdentifiedType;
+
+
+@NoJSR250Annotations
+public final class NettySpringTypesFactory {
+    public NettySpringTypesFactory() {
+        
+    }
+        
+    private static Map<String, TLSServerParameters> toTLSServerParamenters(
+        List <TLSServerParametersIdentifiedType> list) {
+        Map<String, TLSServerParameters> map = new TreeMap<String, TLSServerParameters>();
+        for (TLSServerParametersIdentifiedType t : list) {
+            try {             
+                TLSServerParameters parameter = new TLSServerParametersConfig(t.getTlsServerParameters());
+                map.put(t.getId(), parameter);
+            } catch (Exception e) {
+                throw new RuntimeException(
+                        "Could not configure TLS for id " + t.getId(), e);
+            }
+            
+        }
+        return map;
+    }
+   
+    public Map<String, TLSServerParameters> createTLSServerParametersMap(String s,
+                                                                         JAXBContext ctx) 
+        throws Exception {
+        Document doc = DOMUtils.readXml(new StringReader(s));
+        
+        List <TLSServerParametersIdentifiedType> tlsServerParameters =
+            NettySpringTypesFactory
+                .parseListElement(doc.getDocumentElement(), 
+                                  new QName(NettyHttpServerEngineFactoryBeanDefinitionParser.HTTP_NETTY_SERVER_NS,
+                                            "identifiedTLSServerParameters"),
+                                  TLSServerParametersIdentifiedType.class,
+                                  ctx);
+        Map<String, TLSServerParameters> tlsServerParametersMap =
+            toTLSServerParamenters(tlsServerParameters);
+        return tlsServerParametersMap;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public static <V> List<V> parseListElement(Element parent, 
+                                           QName name, 
+                                           Class<?> c,
+                                           JAXBContext context) throws JAXBException {
+        List<V> list = new ArrayList<V>();
+        Node data = null;
+           
+        Unmarshaller u = context.createUnmarshaller();
+        Node node = parent.getFirstChild();           
+        while (node != null) {
+            if (node.getNodeType() == Node.ELEMENT_NODE && name.getLocalPart().equals(node.getLocalName())
+                && name.getNamespaceURI().equals(node.getNamespaceURI())) {
+                data = node;
+                Object obj = unmarshal(u, data, c);                
+                if (obj != null) {                    
+                    list.add((V) obj);
+                }
+            }
+            node = node.getNextSibling();
+        }
+        return list;
+    }
+    
+    
+
+    
+    
+    private static Object unmarshal(Unmarshaller u,
+                                     Node data, Class<?> c) {
+        if (u == null) {
+            return null;
+        }
+        
+        Object obj = null;        
+        try {
+            if (c != null) {
+                obj = u.unmarshal(data, c);
+            } else {
+                obj = u.unmarshal(data);
+            }
+
+            if (obj instanceof JAXBElement<?>) {
+                JAXBElement<?> el = (JAXBElement<?>)obj;
+                obj = el.getValue();
+            }
+           
+        } catch (JAXBException e) {
+            throw new RuntimeException("Could not parse configuration.", e);
+        }
+        
+        return obj; 
+        
+    }
+               
+
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.handlers?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.handlers (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.handlers Tue Jun 25 02:56:55 2013
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+http\://cxf.apache.org/transports/http-netty-server/configuration=org.apache.cxf.transport.http.netty.server.spring.NamespaceHandler

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.schemas?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.schemas (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/META-INF/spring.schemas Tue Jun 25 02:56:55 2013
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+http\://cxf.apache.org/schemas/configuration/http-netty-server.xsd=schemas/configuration/http-netty-server.xsd

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/http-netty-server.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/http-netty-server.xsd?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/http-netty-server.xsd (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/main/resources/schemas/configuration/http-netty-server.xsd Tue Jun 25 02:56:55 2013
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<xs:schema targetNamespace="http://cxf.apache.org/transports/http-netty-server/configuration" 
+           xmlns:tns="http://cxf.apache.org/transports/http-netty-server/configuration" 
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+           xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
+           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+           xmlns:sec="http://cxf.apache.org/configuration/security"
+  		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  		   xmlns:ptp="http://cxf.apache.org/configuration/parameterized-types" 
+  		   xsi:schemaLocation="
+  		     http://www.springframework.org/schema/beans
+  		       http://www.springframework.org/schema/beans/spring-beans.xsd"
+           elementFormDefault="qualified" 
+           attributeFormDefault="unqualified"
+           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+           jaxb:version="2.0">
+
+    <xs:import namespace="http://cxf.apache.org/configuration/security"
+               schemaLocation="http://cxf.apache.org/schemas/configuration/security.xsd"/>
+    <xs:import namespace="http://cxf.apache.org/configuration/parameterized-types"
+               schemaLocation="http://cxf.apache.org/schemas/configuration/parameterized-types.xsd"/>
+    
+    
+    <xs:complexType name="TLSServerParametersIdentifiedType">
+       <xs:sequence>
+          <xs:element name="tlsServerParameters" type="sec:TLSServerParametersType">
+             <xs:annotation>
+                <xs:documentation>Specifies the properties for the parameter set.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+       </xs:sequence>
+          <xs:attribute name="id" type="xs:string">
+             <xs:annotation>
+                <xs:documentation>Specifies a unique identifier by which the property set can be referred.</xs:documentation>
+             </xs:annotation>
+          </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="ParametersRefType">
+       <xs:attribute name="id" type="xs:string" use="required"/>
+    </xs:complexType>
+    
+    <xs:complexType name="NettyHttpServerEngineConfigType">
+       <xs:sequence>
+         <xs:choice minOccurs="0" maxOccurs="1">
+          <xs:element name="tlsServerParameters" 
+                      type="sec:TLSServerParametersType">
+             <xs:annotation>
+                <xs:documentation>Specifies an instance of the security parameters for the Netty Http server instance.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+          <xs:element name="tlsServerParametersRef"
+                      type="tns:ParametersRefType">
+             <xs:annotation>
+                <xs:documentation>Specifies a reference to a reusable set of security parameters.</xs:documentation>
+             </xs:annotation>
+          </xs:element>
+         </xs:choice>
+         <xs:element name="sessionSupport" type="ptp:ParameterizedBoolean" minOccurs="0"/>
+         <xs:element name="reuseAddress" type="ptp:ParameterizedBoolean" minOccurs="0" />          
+       </xs:sequence>
+       
+       <xs:attribute name="port" type="ptp:ParameterizedInt" use="required">
+             <xs:annotation>
+                <xs:documentation>Specifies the port used by the Netty Http server instance.
+                You can specify a value of 0 for the port attribute. Any threading 
+                properties specified in an engine element with its port attribute
+                set to 0 are used as the configuration for all Netty listeners that are not explicitly configured.</xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="host" type="xs:string">
+             <xs:annotation>
+                <xs:documentation>
+                  Specifies the listen address used by the Netty Http server instance.
+                  Value can be a hostname or ip address.
+                  If not specified, Netty Http server will listen on all local addresses.
+                </xs:documentation>
+             </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="readIdleTime" type="ptp:ParameterizedInt">
+           <xs:annotation>  
+                <xs:documentation>Specifies the maximum read idle time for a Netty connection. The timer is reset whenever there are any read actions on the underlying stream.</xs:documentation> 
+           </xs:annotation>
+       </xs:attribute>
+       <xs:attribute name="writeIdleTime" type="ptp:ParameterizedInt">
+           <xs:annotation>  
+                <xs:documentation>Specifies the maximum write idle time for a Netty connection. The timer is reset whenever there are any write actions on the underlying stream.</xs:documentation> 
+           </xs:annotation>
+       </xs:attribute>
+    </xs:complexType>
+    
+    <xs:complexType name="NettyHttpServerEngineFactoryConfigType">
+       <xs:sequence>
+           <xs:element name="identifiedTLSServerParameters" 
+                       type="tns:TLSServerParametersIdentifiedType"
+                       minOccurs="0" maxOccurs="unbounded">
+              <xs:annotation>
+                 <xs:documentation>Specifies a reusable set of properties for securing an HTTP service provider.</xs:documentation>
+              </xs:annotation>
+           </xs:element>
+           <xs:element name="engine" 
+                       type="tns:NettyHttpServerEngineConfigType" 
+                       minOccurs="0" maxOccurs="unbounded">
+              <xs:annotation>
+                 <xs:documentation>Specifies the configuration for a particular Netty Http server runtime instance.</xs:documentation>
+              </xs:annotation>
+           </xs:element>
+       </xs:sequence>
+       <xs:attribute name="bus" type="xs:string" default="cxf"/>
+       <xs:attribute name="id" type="xs:ID" use="optional"/>
+    </xs:complexType>
+    
+    <xs:element name="engine-factory" 
+                type="tns:NettyHttpServerEngineFactoryConfigType">
+       <xs:annotation>
+          <xs:documentation>Contains the configuration for a Netty Http Server instance.</xs:documentation>
+       </xs:annotation>
+    </xs:element>
+ </xs:schema>

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineTest.java?rev=1496341&r1=1496340&r2=1496341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineTest.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpServerEngineTest.java Tue Jun 25 02:56:55 2013
@@ -89,17 +89,17 @@ public class NettyHttpServerEngineTest e
         
         String response = null;
         response = getResponse(urlStr);
-        assertEquals("The jetty http handler did not take effect", response, "string1");
+        assertEquals("The netty http handler did not take effect", response, "string1");
 
         engine.addServant(new URL(urlStr), handler2);
         response = getResponse(urlStr);
-        assertEquals("The jetty http handler did not take effect", response, "string1string2");
+        assertEquals("The netty http handler did not take effect", response, "string1string2");
         engine.addServant(new URL(urlStr2), handler2);
 
         
         engine.removeServant(new URL(urlStr));
         response = getResponse(urlStr2);
-        assertEquals("The jetty http handler did not take effect", response, "string2");
+        assertEquals("The netty http handler did not take effect", response, "string2");
         engine.shutdown();
         // set the get request
         NettyHttpServerEngineFactory.destroyForPort(PORT1);
@@ -125,14 +125,14 @@ public class NettyHttpServerEngineTest e
         } catch (Exception ex) {
             fail("Can't get the reponse from the server " + ex);
         }
-        assertEquals("the jetty http handler did not take effect", response, "test");
+        assertEquals("the netty http handler did not take effect", response, "test");
 
         try {
             response = getResponse(urlStr2 + "/test");
         } catch (Exception ex) {
             fail("Can't get the reponse from the server " + ex);
         }
-        assertEquals("the jetty http handler did not take effect", response, "test2");
+        assertEquals("the netty http handler did not take effect", response, "test2");
 
         NettyHttpServerEngineFactory.destroyForPort(PORT3);
     }

Modified: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java?rev=1496341&r1=1496340&r2=1496341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java (original)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/integration/NettyServerTest.java Tue Jun 25 02:56:55 2013
@@ -43,7 +43,7 @@ public class NettyServerTest extends Abs
         BusFactory.setThreadDefaultBus(b);
         ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
                 new org.apache.hello_world_soap_http.GreeterImpl());
-
+        
         URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
@@ -67,6 +67,7 @@ public class NettyServerTest extends Abs
 
     @Test
     public void testInvocation() throws Exception {
+        System.out.println("http://localhost:" + PORT + "/SoapContext/SoapPort");
         updateAddressPort(g, PORT);
         String response = g.greetMe("test");
         assertEquals("Get a wrong response", "Hello test", response);

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/ApplicationContextTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/ApplicationContextTest.java?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/ApplicationContextTest.java (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/ApplicationContextTest.java Tue Jun 25 02:56:55 2013
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http.netty.server.spring;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.SAXParseException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.test.TestApplicationContext;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.netty.server.NettyHttpDestination;
+import org.apache.cxf.transport.http.netty.server.NettyHttpServerEngine;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException;
+
+
+public class ApplicationContextTest extends Assert {
+    
+    private static final String S1 = 
+        ApplicationContextTest.class.getResource("/META-INF/cxf/cxf.xml").toString();
+    
+    @Before
+    public void setUp() {
+        BusFactory.setDefaultBus(null);
+    }
+    
+    @After
+    public void clearBus() {
+        BusFactory.setDefaultBus(null);
+    }
+    
+ 
+    @Test
+    public void testInvalid() throws Exception {
+        String s4 = getClass()
+            .getResource("/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml").toString();
+    
+        try {
+            new TestApplicationContext(new String[] {S1, s4});
+            fail("Expected XmlBeanDefinitionStoreException not thrown.");
+        } catch (XmlBeanDefinitionStoreException ex) {
+            assertTrue(ex.getCause() instanceof SAXParseException);
+        }
+    }
+    
+    @Test
+    public void testContext() throws Exception {
+        String s4 = getClass()
+            .getResource("/org/apache/cxf/transport/http/netty/server/spring/beans.xml").toString();
+        
+        TestApplicationContext ctx = new TestApplicationContext(
+            new String[] {S1, s4});
+        
+        //ctx.refresh();
+        checkContext(ctx);
+        ctx.close();
+        ctx.destroy();
+    }
+    @Test
+    public void testContextWithProperties() throws Exception {
+        String s4 = getClass()
+            .getResource("/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml").toString();
+        
+        TestApplicationContext ctx = new TestApplicationContext(
+            new String[] {S1, s4});
+        checkContext(ctx);
+        ctx.close();
+        ctx.destroy();
+    }
+    private void checkContext(TestApplicationContext ctx) throws Exception {
+        ConfigurerImpl cfg = new ConfigurerImpl(ctx);
+        
+        EndpointInfo info = getEndpointInfo("bla", "Foo", "http://localhost:9000");
+        
+        Bus bus = (Bus) ctx.getBean(Bus.DEFAULT_BUS_ID);
+        bus.setExtension(cfg, Configurer.class);
+        
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        DestinationFactory factory = dfm.getDestinationFactory("http://cxf.apache.org/transports/http");
+        Destination d = factory.getDestination(info);
+        assertTrue(d instanceof NettyHttpDestination);
+        NettyHttpDestination jd = (NettyHttpDestination) d;        
+        assertEquals("foobar", jd.getServer().getContentEncoding());   
+        
+        NettyHttpServerEngine engine = (NettyHttpServerEngine)jd.getEngine();
+        //assertEquals(111, engine.getThreadingParameters().getMinThreads());
+        //assertEquals(120, engine.getThreadingParameters().getMaxThreads());
+        
+        ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
+        ConduitInitiator ci = cim.getConduitInitiator("http://cxf.apache.org/transports/http");
+        HTTPConduit conduit = (HTTPConduit) ci.getConduit(info);
+        assertEquals(97, conduit.getClient().getConnectionTimeout());
+        
+        info.setName(new QName("urn:test:ns", "Bar"));
+        conduit = (HTTPConduit) ci.getConduit(info);
+        assertEquals(79, conduit.getClient().getConnectionTimeout());
+
+        NettyHttpDestination jd2 = 
+            (NettyHttpDestination)factory.getDestination(
+                getEndpointInfo("foo", "bar", "http://localhost:9001"));
+        
+        engine = (NettyHttpServerEngine)jd2.getEngine();
+        //assertEquals(40000, engine.getMaxIdleTime());
+        //assertTrue("The engine should support session manager", engine.isSessionSupport());
+        
+        NettyHttpDestination jd3 = 
+            (NettyHttpDestination)factory.getDestination(
+                getEndpointInfo("sna", "foo", "https://localhost:9002"));
+        
+        engine = (NettyHttpServerEngine)jd3.getEngine();
+        assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), true);
+        assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), true);
+        
+        NettyHttpDestination jd4 = 
+            (NettyHttpDestination)factory.getDestination(
+                getEndpointInfo("sna", "foo2", "https://localhost:9003"));
+        
+        engine = (NettyHttpServerEngine)jd4.getEngine();
+        assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), false);
+        assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), false);
+
+        /*NettyHttpDestination jd5 = 
+            (NettyHttpDestination)factory.getDestination(
+                getEndpointInfo("sna", "foo", "http://localhost:9100"));*/
+        
+        /*engine = (NettyHttpServerEngine)jd5.getEngine();
+        String r = "expected fallback thread parameters configured for port 0";
+        assertNotNull(r, engine.getThreadingParameters());
+        assertEquals(r, 21, engine.getThreadingParameters().getMinThreads());
+        assertEquals(r, 389, engine.getThreadingParameters().getMaxThreads());*/
+    }
+    
+    private EndpointInfo getEndpointInfo(String serviceNS, 
+                                         String endpointLocal, 
+                                         String address) {
+        ServiceInfo serviceInfo2 = new ServiceInfo();
+        serviceInfo2.setName(new QName(serviceNS, "Service"));        
+        EndpointInfo info2 = new EndpointInfo(serviceInfo2, "");
+        info2.setName(new QName("urn:test:ns", endpointLocal));
+        info2.setAddress(address);
+        return info2;
+    }
+    
+
+}

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/bean.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/bean.properties?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/bean.properties (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/bean.properties Tue Jun 25 02:56:55 2013
@@ -0,0 +1,30 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+bar.connection.timeout=79
+foo.connection.timeout=97
+engine.port.zero=0
+engine.port.nine.zero=9000
+engine.port.nine.one=9001
+engine.port.nine.two=9002
+engine.port.nine.three=9003
+
+engine.port.zero.minThreads=21
+engine.port.zero.maxThreads=389
+engine.port.nine.one.minThreads=99
+engine.port.nine.one.maxThreads=777
+engine.port.nine.one.readIdle=40000
+engine.port.nine.one.sendServerVersion=false

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans-props.xml Tue Jun 25 02:56:55 2013
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:beans="http://www.springframework.org/schema/beans"    
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:h="http://cxf.apache.org/transports/http/configuration"
+       xmlns:hn="http://cxf.apache.org/transports/http-netty-server/configuration"
+       xmlns:sec="http://cxf.apache.org/configuration/security"
+       xsi:schemaLocation="
+		http://www.springframework.org/schema/beans 
+		    http://www.springframework.org/schema/beans/spring-beans.xsd
+		http://cxf.apache.org/configuration/security 
+		    http://cxf.apache.org/schemas/configuration/security.xsd
+		http://cxf.apache.org/transports/http/configuration 
+		    http://cxf.apache.org/schemas/configuration/http-conf.xsd
+		http://cxf.apache.org/transports/http-netty-server/configuration 
+		    http://cxf.apache.org/schemas/configuration/http-netty-server.xsd"
+>
+	<bean id="placeholderConfig"
+	      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+	  <property name="location" value="org/apache/cxf/transport/http/netty/server/spring/bean.properties"/>
+	</bean>
+	<bean id="placeholderConfig2"
+	      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+	  <property name="location" value="org/apache/cxf/transport/http/netty/server/spring/bean.properties"/>
+	  <property name="placeholderPrefix" value="$("/>
+	  <property name="placeholderSuffix" value=")"/>
+	</bean>
+	<bean id="placeholderConfig3"
+	      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+	  <property name="location" value="org/apache/cxf/transport/http/netty/server/spring/bean.properties"/>
+	  <property name="placeholderPrefix" value="#["/>
+	  <property name="placeholderSuffix" value="]"/>
+	</bean>
+    <h:destination name="{urn:test:ns}Foo.http-destination">
+      <h:server ContentEncoding="foobar"/>
+    </h:destination>
+    
+    <h:conduit name="{urn:test:ns}Foo.http-conduit">
+      <h:client ConnectionTimeout="${foo.connection.timeout}"/>
+    </h:conduit>
+
+    <h:conduit name="*Bar.http-conduit">
+      <h:client ConnectionTimeout="${bar.connection.timeout}"/>
+    </h:conduit>
+
+    <hn:engine-factory bus="cxf">
+       <hn:identifiedTLSServerParameters id="sample1">
+         <hn:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+            <sec:clientAuthentication want="false" required="false"/>
+        </hn:tlsServerParameters>
+       </hn:identifiedTLSServerParameters>
+       
+	   <hn:engine port="$(engine.port.nine.one)" readIdleTime="$(engine.port.nine.one.readIdle)">
+         <hn:sessionSupport>true</hn:sessionSupport>
+	  </hn:engine> 
+	  
+	  <hn:engine port="${engine.port.nine.two}">
+        <hn:tlsServerParameters>
+           <sec:clientAuthentication want="true" required="true"/>
+        </hn:tlsServerParameters>
+      </hn:engine>
+      
+      <hn:engine port="${engine.port.nine.three}">
+         <hn:tlsServerParametersRef id="sample1"/>
+      </hn:engine>
+      
+	</hn:engine-factory>
+</beans>

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans.xml?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans.xml (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/beans.xml Tue Jun 25 02:56:55 2013
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:beans="http://www.springframework.org/schema/beans"    
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:h="http://cxf.apache.org/transports/http/configuration"
+       xmlns:hn="http://cxf.apache.org/transports/http-netty-server/configuration"
+       xmlns:sec="http://cxf.apache.org/configuration/security"
+       xsi:schemaLocation="
+		http://www.springframework.org/schema/beans 
+		    http://www.springframework.org/schema/beans/spring-beans.xsd
+		http://cxf.apache.org/configuration/security 
+		    http://cxf.apache.org/schemas/configuration/security.xsd
+		http://cxf.apache.org/transports/http/configuration 
+		    http://cxf.apache.org/schemas/configuration/http-conf.xsd
+		http://cxf.apache.org/transports/http-netty-server/configuration 
+		    http://cxf.apache.org/schemas/configuration/http-netty-server.xsd"
+>
+
+    <h:destination name="{urn:test:ns}Foo.http-destination">
+      <h:server ContentEncoding="foobar"/>
+    </h:destination>
+    
+    <h:conduit name="{urn:test:ns}Foo.http-conduit">
+      <h:client ConnectionTimeout="97"/>
+    </h:conduit>
+
+    <h:conduit name="*Bar.http-conduit">
+      <h:client ConnectionTimeout="79"/>
+    </h:conduit>
+
+    <hn:engine-factory bus="cxf">
+       <hn:identifiedTLSServerParameters id="sample1">
+         <hn:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+            <sec:clientAuthentication want="false" required="false"/>
+        </hn:tlsServerParameters>
+       </hn:identifiedTLSServerParameters>
+       
+	   <hn:engine port="9000" readIdleTime="30000" writeIdleTime="90000">
+	      <!-- hn:threadingParametersRef id="sampleThreading1"/-->	      
+	   </hn:engine>
+	   
+	   <hn:engine port="0">
+	      <!-- hn:threadingParameters minThreads="21" maxThreads="389"/-->
+	   </hn:engine>
+	   
+	   <hn:engine port="9001" readIdleTime="40000">
+	       <!-- hn:threadingParameters minThreads="99" maxThreads="777"/-->	      
+	     <hn:sessionSupport>true</hn:sessionSupport>
+	  </hn:engine> 
+	  
+	  <hn:engine port="9002">
+        <hn:tlsServerParameters>
+           <sec:clientAuthentication want="true" required="true"/>
+        </hn:tlsServerParameters>
+      </hn:engine>
+      
+      <hn:engine port="9003">
+         <hn:tlsServerParametersRef id="sample1"/>
+      </hn:engine>
+      
+	</hn:engine-factory>
+</beans>

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/invalid-beans.xml Tue Jun 25 02:56:55 2013
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:beans="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:h="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd"
+>
+
+    <h:destination id="{urn:test:ns}Foo.http-destination">
+      <h:server ContentEncoding="foobar"/>
+    </h:destination>
+    
+    <h:conduit id="{urn:test:ns}Foo.http-conduit">
+      <h:client ConnectionTimeout="97"/>
+    </h:conduit>
+</beans>

Added: cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/serverenginefactory.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/serverenginefactory.xml?rev=1496341&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/serverenginefactory.xml (added)
+++ cxf/trunk/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/spring/serverenginefactory.xml Tue Jun 25 02:56:55 2013
@@ -0,0 +1,57 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<hj:engine-factory
+       xmlns:hj="http://cxf.apache.org/transports/http-jetty/configuration"
+       xmlns:sec="http://cxf.apache.org/configuration/security"
+       xmlns:beans="http://www.springframework.org/schema/beans"
+   bus="cxf">
+   
+   <hj:identifiedTLSServerParameters id="sample1">
+      <hj:tlsServerParameters jsseProvider="SUN" secureSocketProtocol="TLS">
+        <sec:clientAuthentication want="false" required="false"/>
+      </hj:tlsServerParameters>
+   </hj:identifiedTLSServerParameters>
+   
+   <hj:identifiedThreadingParameters id="sampleThreading1">
+      <hj:threadingParameters minThreads="11" maxThreads="12"/>
+   </hj:identifiedThreadingParameters>
+   
+   <hj:engine port="9000">
+      <hj:tlsServerParametersRef id="sample1"/>
+      <hj:threadingParameters minThreads="1" maxThreads="2"/>
+   </hj:engine>
+   
+   <hj:engine port="9001">
+      <hj:tlsServerParameters>
+        <sec:clientAuthentication want="true" required="true"/>
+      </hj:tlsServerParameters>
+      <hj:threadingParametersRef id="sampleThreading1"/>
+   </hj:engine>
+   <hj:engine port="9002">
+      <hj:connector>
+         <bean class="jettysocketconnector"/>
+      </hj:connector>
+      <hj:handlers>
+         <bean class="jettyhandler1"/>
+         <bean class="jettyhandler2"/>  
+      </hj:handlers>
+      <hj:useSession> true </hj:useSession>
+   </hj:engine>    
+</hj:engine-factory>
+