cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [6/6] cxf git commit: [CXF-6800]add http-undertow transport
Date Fri, 26 Feb 2016 03:50:56 GMT
[CXF-6800]add http-undertow transport


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e61a83d4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e61a83d4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e61a83d4

Branch: refs/heads/master
Commit: e61a83d4ac18fc760fc5d4bc8fb19d6072aaac52
Parents: 4fd1237
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Fri Feb 26 11:50:30 2016 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Fri Feb 26 11:50:30 2016 +0800

----------------------------------------------------------------------
 parent/pom.xml                                  |  12 +
 rt/transports/http-undertow/pom.xml             | 184 ++++
 .../src/main/build-resources/catalog.cat        |  25 +
 .../http_undertow/CXFUndertowHttpHandler.java   |  26 +
 .../http_undertow/CxfUndertwoServlet.java       |  58 ++
 .../transport/http_undertow/Messages.properties |  85 ++
 .../http_undertow/NotFoundHandler.java          |  35 +
 .../transport/http_undertow/ServerEngine.java   |  44 +
 .../SimpleErrorPageHandler.java.bak             |  51 ++
 .../http_undertow/ThreadingParameters.java      |  84 ++
 .../UndertowDestinationFactory.java             |  42 +
 .../http_undertow/UndertowHTTPDestination.java  | 250 ++++++
 .../http_undertow/UndertowHTTPHandler.java      | 131 +++
 .../http_undertow/UndertowHTTPServerEngine.java | 541 +++++++++++
 .../UndertowHTTPServerEngineFactory.java        | 341 +++++++
 .../HTTPUndertowTransportNamespaceHandler.java  |  83 ++
 .../UndertowHTTPServerEngineFactoryHolder.java  | 234 +++++
 .../UndertowServerEngineFactoryParser.java      | 112 +++
 .../blueprint/UndertowServerEngineParser.java   |  32 +
 .../osgi/HTTPUndertowTransportActivator.java    | 382 ++++++++
 .../http_undertow/spring/NamespaceHandler.java  |  30 +
 ...towHTTPServerEngineBeanDefinitionParser.java | 345 +++++++
 ...ServerEngineFactoryBeanDefinitionParser.java | 159 ++++
 .../spring/UndertowSpringTypesFactory.java      | 172 ++++
 .../main/resources/META-INF/blueprint.handlers  |  22 +
 .../resources/META-INF/cxf/bus-extensions.txt   |   2 +
 .../src/main/resources/META-INF/spring.handlers |  21 +
 .../src/main/resources/META-INF/spring.schemas  |  21 +
 .../schemas/configuration/http-undertow.xsd     | 195 ++++
 .../UndertowHTTPDestinationTest.java            | 892 +++++++++++++++++++
 .../UndertowHTTPServerEngineFactoryTest.java    | 145 +++
 .../UndertowHTTPServerEngineTest.java           | 266 ++++++
 .../http_undertow/UndertowHTTPTestHandler.java  |  78 ++
 ...TPUndertowTransportNamespaceHandlerTest.java |  36 +
 .../transport/http_undertow/invalid-engines.xml |  28 +
 .../http_undertow/server-engine-factory.xml     |  28 +
 .../spring/ApplicationContextTest.java          | 184 ++++
 .../http_undertow/spring/TestDummyHandler.java  |  41 +
 .../http_undertow/spring/bean.properties        |  30 +
 .../http_undertow/spring/beans-props.xml        |  74 ++
 .../transport/http_undertow/spring/beans.xml    |  61 ++
 .../transport/http_undertow/spring/conduit.xml  |  22 +
 .../http_undertow/spring/destination.xml        |  23 +
 .../http_undertow/spring/invalid-beans.xml      |  27 +
 .../spring/serverenginefactory.xml              |  45 +
 rt/transports/pom.xml                           |   1 +
 systests/pom.xml                                |   1 +
 systests/transport-undertow/pom.xml             | 253 ++++++
 .../http_undertow/ClientServerSessionTest.java  | 275 ++++++
 .../apache/cxf/systest/http_undertow/Dummy.java |  32 +
 .../systest/http_undertow/DummyInterface.java   |  29 +
 .../cxf/systest/http_undertow/GreeterImpl.java  | 144 +++
 .../http_undertow/GreeterSessionImpl.java       | 154 ++++
 .../http_undertow/MapIdentityManager.java       | 126 +++
 .../PerRequestAnnotationGreeterImpl.java        |  98 ++
 .../cxf/systest/http_undertow/Server.java       |  65 ++
 .../SessionAnnotationGreeterImpl.java           | 101 +++
 .../systest/http_undertow/SessionServer.java    |  58 ++
 .../SpringAnnotationGreeterImpl.java            |  99 ++
 .../http_undertow/StatefulGreeterImpl.java      |  96 ++
 .../systest/http_undertow/ThreadPoolTest.java   | 112 +++
 .../http_undertow/UndertowBasicAuthHandler.java |  80 ++
 .../http_undertow/UndertowBasicAuthServer.java  |  70 ++
 .../http_undertow/UndertowBasicAuthTest.java    | 102 +++
 .../UndertowDigestAuthHandler.java              |  81 ++
 .../http_undertow/UndertowDigestAuthTest.java   | 202 +++++
 .../ClientServerWrappedContinuationTest.java    | 159 ++++
 .../continuations/ControlWorker.java            |  59 ++
 .../continuations/HelloContinuation.java        |  36 +
 .../continuations/HelloContinuationService.java |  49 +
 .../HelloImplWithWrapppedContinuation.java      | 129 +++
 .../continuations/HelloWorker.java              |  67 ++
 .../src/test/resources/keys/Bethal.jks          | Bin 0 -> 2202 bytes
 .../src/test/resources/keys/Bethal.p12          | Bin 0 -> 2540 bytes
 .../src/test/resources/keys/Gordy.jks           | Bin 0 -> 2197 bytes
 .../src/test/resources/keys/Morpit.jks          | Bin 0 -> 2221 bytes
 .../src/test/resources/keys/Morpit.p12          | Bin 0 -> 2564 bytes
 .../src/test/resources/keys/Poltim.jks          | Bin 0 -> 2203 bytes
 .../src/test/resources/keys/Tarpin.jks          | Bin 0 -> 2201 bytes
 .../src/test/resources/keys/Truststore.jks      | Bin 0 -> 4447 bytes
 .../src/test/resources/keys/Truststore.pem      |  86 ++
 .../src/test/resources/keys/alice.jks           | Bin 0 -> 4125 bytes
 .../src/test/resources/keys/bob.jks             | Bin 0 -> 4122 bytes
 .../src/test/resources/keys/cxfca.jks           | Bin 0 -> 961 bytes
 .../src/test/resources/keys/genkeys.sh          |  53 ++
 .../src/test/resources/keys/subjalt.jks         | Bin 0 -> 8891 bytes
 .../cxf/systest/http_undertow/SessionServer.xml |  46 +
 .../systest/http_undertow/continuations/cxf.xml |  24 +
 .../http_undertow/continuations/cxf_https.xml   |  36 +
 .../continuations/jaxws-server.xml              |  47 +
 .../http_undertow/continuations/test.wsdl       | 100 +++
 .../apache/cxf/systest/http_undertow/cxf.xml    |  24 +
 .../http_undertow/server-lifecycle-beans.xml    |  47 +
 .../apache/cxf/systest/http_undertow/server.xml |  27 +
 .../apache/cxf/systest/http_undertow/test.html  |  23 +
 .../systest/http_undertow/undertow-engine.xml   |  45 +
 .../http_undertow/undertowBasicAuthServer.xml   |  29 +
 .../http_undertow/undertowDigestServer.xml      |  29 +
 98 files changed, 8993 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 45b7e36..b381bfc 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -118,6 +118,8 @@
         <cxf.jetty9.version>9.3.5.v20151012</cxf.jetty9.version>
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
         <cxf.jetty.osgi.version>[8.1,10)</cxf.jetty.osgi.version>
+        <cxf.undertow.version>1.3.7.Final</cxf.undertow.version>
+        <cxf.undertow.osgi.version>[1.3.7, 1.4)</cxf.undertow.osgi.version>
         <cxf.jibx.version>1.2.6</cxf.jibx.version>
         <cxf.junit.version>4.12</cxf.junit.version>
         <cxf.maven.core.version>3.0.5</cxf.maven.core.version>
@@ -1008,6 +1010,16 @@
                 <version>${cxf.jetty.version}</version>
             </dependency>
             <dependency>
+                 <groupId>io.undertow</groupId>
+                 <artifactId>undertow-core</artifactId>
+                 <version>${cxf.undertow.version}</version>
+            </dependency>
+            <dependency>
+                 <groupId>io.undertow</groupId>
+                 <artifactId>undertow-servlet</artifactId>
+                 <version>${cxf.undertow.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>xalan</groupId>
                 <artifactId>xalan</artifactId>
                 <version>${cxf.xalan.version}</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/pom.xml
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/pom.xml b/rt/transports/http-undertow/pom.xml
new file mode 100644
index 0000000..64cc205
--- /dev/null
+++ b/rt/transports/http-undertow/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-transports-http-undertow</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache CXF Runtime HTTP Undertow Transport</name>
+    <description>Apache CXF Runtime HTTP Undertow Transport</description>
+    <url>http://cxf.apache.org</url>
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+    <properties>
+        <cxf.bundle.activator>org.apache.cxf.transport.http_undertow.osgi.HTTPUndertowTransportActivator</cxf.bundle.activator>
+        <cxf.osgi.import>
+            javax.servlet*;version="${cxf.osgi.javax.servlet.version}",
+            io.undertow*;version="${cxf.undertow.osgi.version}",
+            org.apache.aries*;version="${cxf.aries.version.range}";resolution:=optional,
+            org.springframework*;resolution:="optional";version="${cxf.osgi.spring.version}"
+        </cxf.osgi.import>
+        <!-- keep in sync with services exported in activator -->
+        <cxf.export.service>
+            org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace="http://cxf.apache.org/transports/http-undertow/configuration"
+        </cxf.export.service>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.core</artifactId>
+            <scope>provided</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-parser</artifactId>
+            <scope>provided</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.undertow</groupId>
+            <artifactId>undertow-core</artifactId>
+            <version>1.3.7.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>io.undertow</groupId>
+            <artifactId>undertow-servlet</artifactId>
+            <version>1.3.7.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+        </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>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-wsdl</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <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>
+                            <extensions>
+                                <extension>org.apache.cxf.xjcplugins:cxf-xjc-bug986:${cxf.xjc-utils.version}</extension>
+                            </extensions>
+                            <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+                            <xsdOptions>
+                                <xsdOption>
+                                    <extensionArgs>
+                                        <arg>-Xbug986</arg>
+                                    </extensionArgs>
+                                    <xsd>${basedir}/src/main/resources/schemas/configuration/http-undertow.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>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/build-resources/catalog.cat
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/build-resources/catalog.cat b/rt/transports/http-undertow/src/main/build-resources/catalog.cat
new file mode 100644
index 0000000..6d5bd2a
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/build-resources/catalog.cat
@@ -0,0 +1,25 @@
+--
+  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.
+--
+
+
+SYSTEM "http://schemas.xmlsoap.org/wsdl/" "../../../../../../core/src/main/resources/schemas/wsdl/wsdl.xsd"
+SYSTEM "http://cxf.apache.org/schemas/configuration/security.xsd" "../../../../../../core/src/main/resources/schemas/configuration/security.xsd"
+SYSTEM "http://cxf.apache.org/schemas/configuration/parameterized-types.xsd" "../../../../../../core/src/main/resources/schemas/configuration/parameterized-types.xsd"
+SYSTEM "http://cxf.apache.org/schemas/wsdl/http-conf.xsd"         "../../../../../../rt/transports/http/src/main/resources/schemas/wsdl/http-conf.xsd"
+SYSTEM "http://cxf.apache.org/schemas/configuration/http-undertow.xsd" "schemas/configuration/http-undertow.xsd"

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CXFUndertowHttpHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CXFUndertowHttpHandler.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CXFUndertowHttpHandler.java
new file mode 100644
index 0000000..607a66a
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CXFUndertowHttpHandler.java
@@ -0,0 +1,26 @@
+/**
+ * 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_undertow;
+
+import io.undertow.server.HttpHandler;
+
+public interface CXFUndertowHttpHandler extends HttpHandler {
+    void setNext(HttpHandler nextHandler);
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CxfUndertwoServlet.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CxfUndertwoServlet.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CxfUndertwoServlet.java
new file mode 100644
index 0000000..efb60d7
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/CxfUndertwoServlet.java
@@ -0,0 +1,58 @@
+/**
+ * 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_undertow;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.transport.servlet.AbstractHTTPServlet;
+
+public class CxfUndertwoServlet extends AbstractHTTPServlet {
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+        throws IOException, ServletException {
+  
+    }
+
+    @Override
+    protected Bus getBus() {
+        return null;
+    }
+
+    @Override
+    protected void invoke(HttpServletRequest request, HttpServletResponse response) throws ServletException {
+        UndertowHTTPDestination undertowHTTPDestination = 
+            (UndertowHTTPDestination)request.getAttribute("UNDERTOW_DESTINATION");
+        try {
+            undertowHTTPDestination.doService(request.getServletContext(), request, response);
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new ServletException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/Messages.properties
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/Messages.properties b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/Messages.properties
new file mode 100644
index 0000000..ebacf5d
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/Messages.properties
@@ -0,0 +1,85 @@
+#
+#
+#    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.
+#
+#
+START_UP_SERVER_FAILED_MSG = Could not start Undertow server on port {1}: {0}
+ADD_HANDLER_FAILED_MSG = Could not add cxf undertow handler to Undertow server: {0}
+ADD_HANDLER_CONTEXT_IS_USED_MSG = Could not add cxf undertow handler for url {0} to Undertow server, as the path {1} is still in use.
+ADD_HANDLER_CONTEXT_CONFILICT_MSG = Could not add cxf undertow handler for url {0} to Undertow server, as it conflicts with the registered path {1}.
+REMOVE_HANDLER_FAILED_MSG = Could not remove cxf undertow handler from Undertow server: {0}
+CAN_NOT_FIND_HANDLER_MSG = Could not find the handler to remove for context url {0}
+FAILED_TO_SHUTDOWN_ENGINE_MSG = Failed to shutdown Undertow server on port {0,number,####0} because it is still in use
+UNKNOWN_CONNECTOR_MSG = Unknown connector type {0}, can''t set the socket reuseAddress flag.
+INVALID_ENCODING_MSG = Invalid character set {0} in request.
+FALLBACK_THREADING_PARAMETERS_MSG = No explicitly configured threading parameters for port {0}, using fallback values min:{1} max:{2}
+NOT_ENOUGH_THREADS = Not enough threads configured for port {0}.  Need at least {1} ({3} for Undertow selectors and set managers) but only {2} configured.
+NOT_A_QUEUED_THREAD_POOL = {0} is not an instanceof QueuedThreadPool.  Cannot set threading parameters.
+
+SSL_CONTEXT_INIT_FAILURE = Problem initializing ssl for the outbound request, exception reported from security provider is : {0}
+UNKNOWN_SSL_CLIENT_POLICY_DATA = Unknown SSLClientPolicy property : {0}
+UNKNOWN_SSL_SERVER_POLICY_DATA = Unknown SSLServerPolicy property : {0}
+UNSUPPORTED_SSL_CLIENT_POLICY_DATA = Unsupported SSLClientPolicy property : {0}
+UNSUPPORTED_SSL_SERVER_POLICY_DATA = Unsupported SSLServerPolicy property : {0}
+KEY_STORE_NOT_SET = The location of the key store has not been set via a system parameter or through configuration so the default value of {0} will be used.
+KEY_STORE_SET = The keystore location is set to {0}.
+KEY_STORE_SYSTEM_PROPERTY_SET = The keystore location is set via a system property to {0}.
+KEY_STORE_TYPE_NOT_SET = The key store type has not been set in configuration so the default value of {0} will be used.
+KEY_STORE_TYPE_SET = The key store type has been set in configuration to {0}.
+LOADED_KEYSTORE = Successfully loaded keystore, {0}.
+FAILED_TO_LOAD_KEYSTORE = Loading the keystore {0}, failed with the following problem: {1}.
+FAILED_TO_LOAD_KEYSTORE_NULL_PASSWORD = Loading the keystore. {0}, failed because the password is not set.
+TRUST_STORE_NOT_SET = The location of the trust store has not been set via a system parameter or through configuration so the default value of {0} will be used.
+TRUST_STORE_SET = The trust store location has been set in configuration to {0}.
+TRUST_STORE_SYSTEM_PROPERTY_SET = The trust store location has been via a system property to {0}.
+TRUST_STORE_TYPE_NOT_SET = The trust store type has not been set in configuration so the default value of {0} will be used.
+TRUST_STORE_TYPE_SET = The trust store type has been set in configuration to {0}.
+FAILED_TO_LOAD_TRUST_STORE = Loading the truststore, {0}, failed with the following problem: {1}.
+LOADED_TRUST_STORE = Successfully loaded trust store, {0}.
+KEY_STORE_PASSWORD_NOT_SET = The key store password has not been set via a system property or through configuration, reading data from the keystore will fail.
+KEY_STORE_PASSWORD_SET = The key store password was found to be set in configuration and will be used.
+KEY_STORE_PASSWORD_SYSTEM_PROPERTY_SET = The key store password was found to be set as a system property and will be used.
+KEY_PASSWORD_NOT_SET = The key password has not been set via a system property or through configuration, reading data from the keystore will fail.
+KEY_PASSWORD_SET = The key password was found to be set in configuration and will be used.
+KEY_PASSWORD_SYSTEM_PROPERTY_SET = The key  password was found to be set as a system property and will be used.
+SECURE_SOCKET_PROTOCOL_NOT_SET = The secure socket protocol is not set so using default value TLSv1.
+SECURE_SOCKET_PROTOCOL_SET = The secure socket protocol has been set to {0}.
+REQUIRE_CLIENT_AUTHENTICATION_NOT_SET = Require client authentication has not been set explicitly in configuration so defaulting to false.
+REQUIRE_CLIENT_AUTHENTICATION_SET = Require client authentication is set to {0}.
+WANT_CLIENT_AUTHENTICATION_NOT_SET = Want client authentication has not been set explicitly in configuration so defaulting to false.
+WANT_CLIENT_AUTHENTICATION_SET = Want client authentication is set to {0}.
+KEY_PASSWORD_NOT_SAME_KEYSTORE_PASSWORD = The value specified for the keystore password is different to the key password. Currently limitations in JSSE requires that they should be the same. The keystore password value will be used only.
+CIPHERSUITES_SET = The cipher suites have been set to {0}.  
+CIPHERSUITES_NOT_SET = The cipher suites have not been configured, falling back to cipher suite filters.
+CIPHERSUITE_FILTERS_NOT_SET = The cipher suite filters have not been configured, falling back to default filters.
+CIPHERSUITE_FILTER = Ciphersuite filter: 
+CIPHERSUITE_INCLUDED = The {0} cipher suite is included by the filter.
+CIPHERSUITE_EXCLUDED = The {0} cipher suite is excluded by the filter.
+CIPHERSUITE_INCLUDE_FILTER = Ciphersuite include filter: {0}
+CIPHERSUITE_EXCLUDE_FILTER = Ciphersuite exclude filter: {0}
+CIPHERSUITES_FILTERED = The enabled cipher suites have been filtered down to {0}.
+CIPHERSUITES_EXCLUDED = The excluded cipher suites have been filtered down to {0}.  
+SUCCESS_INVOKING_SECURITY_CONFIGURER = The custom security configurer {0} configure method was called successfully.
+ERROR_INVOKING_SECURITY_CONFIGURER = Failure invoking on custom security configurer {0}, exception reported is {1}.
+KEY_STORE_ALGORITHM_NOT_SET = The keystore key manager factory algorithm has not been set in configuration so the default value {0} will be used.
+KEY_STORE_ALGORITHM_SET = The keystore key manager factory algorithm has been set in configuration to {0}.
+TRUST_STORE_ALGORITHM_NOT_SET = The truststore key manager factory algorithm has not been set in configuration so the default value {0} will be used.
+TRUST_STORE_ALGORITHM_SET = The trust store key manager factory algorithm has been set in configuration to {0}.
+COULD_NOT_CREATE_OUTBOUND_REQUEST_SOCKET = Failed to create a connection to host {0} and port {1}, error reported is {2}. 
+PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET = Failed to create a connection to host {0} and port {1}.
+UNOFFICIAL_SECURITY_CONFIGURER = Use of the security configurer is supported for version 1.0 of Celtix but the API is subject to change in later versions.

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/NotFoundHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/NotFoundHandler.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/NotFoundHandler.java
new file mode 100644
index 0000000..72a1cb2
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/NotFoundHandler.java
@@ -0,0 +1,35 @@
+/**
+ * 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_undertow;
+
+import io.undertow.server.HttpHandler;
+import io.undertow.server.HttpServerExchange;
+import io.undertow.util.Headers;
+
+public class NotFoundHandler implements HttpHandler {
+    
+    @Override
+    public void handleRequest(HttpServerExchange exchange) throws Exception {
+        exchange.setResponseCode(404);
+        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
+        exchange.getResponseSender().send("Problem accessing " + exchange.getRequestPath());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ServerEngine.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ServerEngine.java
new file mode 100644
index 0000000..ce6a6d5
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ServerEngine.java
@@ -0,0 +1,44 @@
+/**
+ * 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_undertow;
+
+import java.net.URL;
+
+
+public interface ServerEngine {
+    
+    void addServant(URL url, UndertowHTTPHandler handler);
+
+    /**
+     * Remove a previously registered servant.
+     *
+     * @param url the URL the servant was registered against.
+     */
+    void removeServant(URL url);
+
+    /**
+     * Get a previously  registered servant.
+     *
+     * @param url the associated URL
+     * @return the HttpHandler if registered
+     */
+    UndertowHTTPHandler getServant(URL url);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/SimpleErrorPageHandler.java.bak
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/SimpleErrorPageHandler.java.bak b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/SimpleErrorPageHandler.java.bak
new file mode 100644
index 0000000..e6936f1
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/SimpleErrorPageHandler.java.bak
@@ -0,0 +1,51 @@
+/**
+ * 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_undertow;
+
+import io.undertow.io.Sender;
+import io.undertow.server.HttpHandler;
+import io.undertow.server.HttpServerExchange;
+import io.undertow.util.Headers;
+
+
+public class SimpleErrorPageHandler implements HttpHandler {
+
+    private final HttpHandler next;
+
+    public SimpleErrorPageHandler(final HttpHandler next) {
+        this.next = next;
+    }
+
+    @Override
+    public void handleRequest(final HttpServerExchange exchange) throws Exception {
+        try {
+            next.handleRequest(exchange);
+        } catch (Throwable t) {
+            if(exchange.isResponseChannelAvailable()) {
+                if (exchange.getResponseCode() == 500) {
+                    final String errorPage = "<html><head><title>Error</title></head><body>Internal Error 500</body></html>";
+                    exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, "" + errorPage.length());
+                    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/html");
+                    Sender sender = exchange.getResponseSender();
+                    sender.send(errorPage);
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ThreadingParameters.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ThreadingParameters.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ThreadingParameters.java
new file mode 100644
index 0000000..60d6fef
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/ThreadingParameters.java
@@ -0,0 +1,84 @@
+/**
+ * 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_undertow;
+
+public class ThreadingParameters {
+    /**
+     * Specify the number of I/O threads to create for the worker.  If not specified, a default will be chosen.
+     * One IO thread per CPU core is a reasonable default.
+     */
+    private int workerIOThreads;
+    
+    /**
+     * Specify the number of "core" threads for the worker task thread pool.
+     * Generally this should be reasonably high, at least 10 per CPU core.
+     */
+    private int minThreads;
+    
+    /**
+     * Specify the maximum number of threads for the worker task thread pool.
+     */
+    private int maxThreads;
+    private boolean workerIOThreadsSet;
+    private boolean minThreadsSet;
+    private boolean maxThreadsSet;
+    
+    public void setWorkerIOThreads(int number) {
+        workerIOThreadsSet = true;
+        workerIOThreads = number;
+    }
+    
+    public void setMinThreads(int number) {
+        minThreadsSet = true;
+        minThreads = number;
+    }
+
+    public void setMaxThreads(int number) {
+        maxThreadsSet = true;
+        maxThreads = number;
+    }
+    
+    public int getWorkerIOThreads() {
+        return workerIOThreads;
+    }
+    
+    public int getMinThreads() {
+        return minThreads;
+    }
+
+    public int getMaxThreads() {
+        return maxThreads;
+    }
+
+    public boolean isWorkerIOThreadsSet() {
+        return workerIOThreadsSet;
+    }
+
+    
+    public boolean isMinThreadsSet() {
+        return minThreadsSet;
+    }
+
+    
+    public boolean isMaxThreadsSet() {
+        return maxThreadsSet;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowDestinationFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowDestinationFactory.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowDestinationFactory.java
new file mode 100644
index 0000000..a67d6ae
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowDestinationFactory.java
@@ -0,0 +1,42 @@
+/**
+ * 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_undertow;
+
+import java.io.IOException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http.HttpDestinationFactory;
+
+
+@NoJSR250Annotations()
+public class UndertowDestinationFactory implements HttpDestinationFactory {
+
+    public AbstractHTTPDestination createDestination(EndpointInfo endpointInfo, Bus bus,
+                                                     DestinationRegistry registry) throws IOException {
+        UndertowHTTPServerEngineFactory serverEngineFactory = bus
+            .getExtension(UndertowHTTPServerEngineFactory.class);
+        return new UndertowHTTPDestination(bus, registry, endpointInfo, serverEngineFactory);
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
new file mode 100644
index 0000000..7b6ae3e
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
@@ -0,0 +1,250 @@
+/**
+ * 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_undertow;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
+
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.servlet.ServletDestination;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+
+
+
+public class UndertowHTTPDestination extends ServletDestination {
+    
+    private static final Logger LOG =
+        LogUtils.getL7dLogger(UndertowHTTPDestination.class);
+    
+    protected UndertowHTTPServerEngine engine;
+    protected UndertowHTTPServerEngineFactory serverEngineFactory;
+    protected URL nurl;
+    protected ClassLoader loader;
+    protected ServletContext servletContext;
+    /**
+     * This variable signifies that finalizeConfig() has been called.
+     * It gets called after this object has been spring configured.
+     * It is used to automatically reinitialize things when resources
+     * are reset.
+     */
+    private boolean configFinalized;
+
+    /**
+     * Constructor
+     *
+     * @param bus  the associated Bus
+     * @param registry the associated destinationRegistry
+     * @param ei the endpoint info of the destination
+     * @param serverEngineFactory the serverEngineFactory which could be used to create ServerEngine
+     * @throws java.io.IOException
+     */
+    public UndertowHTTPDestination(Bus bus, 
+                                   DestinationRegistry registry, 
+                                   EndpointInfo ei, 
+                                   UndertowHTTPServerEngineFactory serverEngineFactory)
+        throws IOException {
+        //Add the default port if the address is missing it
+        super(bus, registry, ei, getAddressValue(ei, true).getAddress(), true);
+        this.serverEngineFactory = serverEngineFactory;
+        if (serverEngineFactory != null) {
+            nurl = new URL(getAddress(endpointInfo));
+        }
+        loader = bus.getExtension(ClassLoader.class);
+    }
+    
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
+    
+    
+    
+    /**
+     * Post-configure retreival of server engine.
+     */
+    protected void retrieveEngine()
+        throws GeneralSecurityException, 
+               IOException {
+        if (serverEngineFactory == null) {
+            return;
+        }
+        engine = 
+            serverEngineFactory.retrieveUndertowHTTPServerEngine(nurl.getPort());
+        if (engine == null) {
+            engine = serverEngineFactory.
+                createUndertowHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol());
+        }
+
+        // When configuring for "http", however, it is still possible that
+        // Spring configuration has configured the port for https. 
+        if (!nurl.getProtocol().equals(engine.getProtocol())) {
+            throw new IllegalStateException(
+                "Port " + engine.getPort() 
+                + " is configured with wrong protocol \"" 
+                + engine.getProtocol()
+                + "\" for \"" + nurl + "\"");
+        }
+    }
+    
+    /**
+     * This method is used to finalize the configuration
+     * after the configuration items have been set.
+     *
+     */
+    public void finalizeConfig() {
+        assert !configFinalized;
+        
+        try {
+            retrieveEngine();
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+        configFinalized = true;
+    }
+    
+    /**
+     * Activate receipt of incoming messages.
+     */
+    protected void activate() {
+        super.activate();
+        LOG.log(Level.FINE, "Activating receipt of incoming messages");
+                
+        if (engine != null) {
+            UndertowHTTPHandler jhd = createUndertowHTTPHandler(this, contextMatchOnExact());
+            engine.addServant(nurl, jhd);
+        }
+    }
+
+    protected UndertowHTTPHandler createUndertowHTTPHandler(UndertowHTTPDestination jhd,
+                                                    boolean cmExact) {
+        return new UndertowHTTPHandler(jhd, cmExact);
+    }
+
+    /**
+     * Deactivate receipt of incoming messages.
+     */
+    protected void deactivate() {
+        super.deactivate();
+        LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
+        if (engine != null) {
+            engine.removeServant(nurl);
+        }
+    }   
+     
+
+    
+    protected String getBasePathForFullAddress(String addr) {
+        try {
+            return new URL(addr).getPath();
+        } catch (MalformedURLException e) {
+            return null;
+        }
+    }
+    
+     
+    protected void doService(HttpServletRequest req,
+                             HttpServletResponse resp) throws IOException {
+        doService(servletContext, req, resp);
+    }
+        
+    protected void doService(ServletContext context,
+                             HttpServletRequest req,
+                             HttpServletResponse resp) throws IOException {
+        if (context == null) {
+            context = servletContext;
+        }
+        HTTPServerPolicy sp = getServer();
+        if (sp.isSetRedirectURL()) {
+            resp.sendRedirect(sp.getRedirectURL());
+            resp.flushBuffer();
+            return;
+        }
+
+        ClassLoaderHolder origLoader = null;
+        Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus);
+        try {
+            if (loader != null) {
+                origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
+            }
+            invoke(null, context, req, resp);
+        } finally {
+            if (origBus != bus) {
+                BusFactory.setThreadDefaultBus(origBus);
+            }
+            if (origLoader != null) { 
+                origLoader.reset();
+            }
+        }    
+    }
+    
+    protected void invokeComplete(final ServletContext context, 
+                                  final HttpServletRequest req, 
+                                  final HttpServletResponse resp,
+                                  Message m) throws IOException {
+        resp.flushBuffer();
+        super.invokeComplete(context, req, resp, m);
+    }
+    
+    public void setServletContext(ServletContext sc) {
+        servletContext = sc;
+    }
+    
+    protected Message retrieveFromContinuation(HttpServletRequest req) {
+        return (Message)req.getAttribute(CXF_CONTINUATION_MESSAGE);
+    }
+    
+    protected void setupContinuation(Message inMessage, final HttpServletRequest req,
+                                     final HttpServletResponse resp) {
+        if (engine != null && engine.getContinuationsEnabled()) {
+            super.setupContinuation(inMessage, req, resp);
+        }
+    }
+        
+    protected OutputStream flushHeaders(Message outMessage, boolean getStream) throws IOException {
+        return super.flushHeaders(outMessage, getStream);
+    }
+    
+      
+    protected String getAddress(EndpointInfo endpointInfo) {
+        return endpointInfo.getAddress();
+    }
+    
+    public ServerEngine getEngine() {
+        return engine;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
new file mode 100644
index 0000000..303bf14
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
@@ -0,0 +1,131 @@
+/**
+ * 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_undertow;
+
+
+import javax.servlet.ServletContext;
+
+import org.apache.cxf.Bus;
+
+import io.undertow.io.Sender;
+import io.undertow.server.HttpHandler;
+import io.undertow.server.HttpServerExchange;
+import io.undertow.server.SSLSessionInfo;
+import io.undertow.servlet.handlers.ServletRequestContext;
+import io.undertow.servlet.spec.HttpServletRequestImpl;
+import io.undertow.servlet.spec.HttpServletResponseImpl;
+import io.undertow.servlet.spec.ServletContextImpl;
+import io.undertow.util.Headers;
+
+
+
+public class UndertowHTTPHandler implements HttpHandler {
+    
+    private static final String SSL_CIPHER_SUITE_ATTRIBUTE = "javax.servlet.request.cipher_suite";
+    private static final String SSL_PEER_CERT_CHAIN_ATTRIBUTE = "javax.servlet.request.X509Certificate";
+
+    protected UndertowHTTPDestination undertowHTTPDestination;
+    protected ServletContext servletContext;
+    private boolean contextMatchExact;
+    private String urlName;
+    private Bus bus;
+        
+    public UndertowHTTPHandler(UndertowHTTPDestination uhd, boolean cmt) {
+        undertowHTTPDestination = uhd;
+        this.contextMatchExact = cmt;
+    }
+    public UndertowHTTPHandler(Bus bus) {
+        this.bus = bus;
+    }
+    
+    public boolean isContextMatchExact() {
+        return this.contextMatchExact;
+    }
+    
+    public void setServletContext(ServletContext sc) {
+        servletContext = sc;
+        if (undertowHTTPDestination != null) {
+            undertowHTTPDestination.setServletContext(sc);
+        }
+    }
+
+    public void setName(String name) {
+        urlName = name;
+    }
+
+    public String getName() {
+        return urlName;
+    }
+
+   
+    public Bus getBus() {
+        return undertowHTTPDestination != null ? undertowHTTPDestination.getBus() : bus;
+    }
+
+    @Override
+    public void handleRequest(HttpServerExchange undertowExchange) throws Exception {
+        try {
+            // perform blocking operation on exchange
+            if (undertowExchange.isInIoThread()) {
+                undertowExchange.dispatch(this);
+                return;
+            }
+            HttpServletResponseImpl response = new HttpServletResponseImpl(undertowExchange,
+                                                                           (ServletContextImpl)servletContext);
+            HttpServletRequestImpl request = new HttpServletRequestImpl(undertowExchange,
+                                                                        (ServletContextImpl)servletContext);
+
+            ServletRequestContext servletRequestContext = new ServletRequestContext(((ServletContextImpl)servletContext)
+                .getDeployment(), request, response, null);
+            
+             
+            undertowExchange.putAttachment(ServletRequestContext.ATTACHMENT_KEY, servletRequestContext);
+            request.setAttribute("HTTP_HANDLER", this);
+            request.setAttribute("UNDERTOW_DESTINATION", undertowHTTPDestination);
+            SSLSessionInfo ssl = undertowExchange.getConnection().getSslSessionInfo();
+            if (ssl != null) {
+                request.setAttribute(SSL_CIPHER_SUITE_ATTRIBUTE, ssl.getCipherSuite());
+                try {
+                    request.setAttribute(SSL_PEER_CERT_CHAIN_ATTRIBUTE, ssl.getPeerCertificates());
+                } catch (Exception e) {
+                    // for some case won't have the peer certification
+                    // do nothing
+                }
+            }
+            undertowHTTPDestination.doService(servletContext, request, response);
+            
+        } catch (Throwable t) {
+            t.printStackTrace();
+            if (undertowExchange.isResponseChannelAvailable()) {
+                undertowExchange.setResponseCode(500);
+                final String errorPage = "<html><head><title>Error</title>"
+                    + "</head><body>Internal Error 500" + t.getMessage()
+                    + "</body></html>";
+                undertowExchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,
+                                                          "" + errorPage.length());
+                undertowExchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/html");
+                Sender sender = undertowExchange.getResponseSender();
+                sender.send(errorPage);
+            }
+        }
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/e61a83d4/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
new file mode 100644
index 0000000..b6c772d
--- /dev/null
+++ b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
@@ -0,0 +1,541 @@
+/**
+ * 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_undertow;
+
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.X509KeyManager;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PropertyUtils;
+import org.apache.cxf.common.util.SystemPropertyAction;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.transport.HttpUriMapper;
+import org.apache.cxf.transport.https.AliasedX509ExtendedKeyManager;
+import org.xnio.Options;
+import org.xnio.Sequence;
+import org.xnio.SslClientAuthMode;
+
+import io.undertow.Handlers;
+import io.undertow.Undertow;
+import io.undertow.Undertow.Builder;
+import io.undertow.UndertowOptions;
+import io.undertow.server.HttpHandler;
+import io.undertow.server.handlers.PathHandler;
+import io.undertow.servlet.api.DeploymentInfo;
+import io.undertow.servlet.api.DeploymentManager;
+import io.undertow.servlet.api.ServletContainer;
+import io.undertow.servlet.api.ServletInfo;
+import io.undertow.servlet.core.ServletContainerImpl;
+import io.undertow.servlet.handlers.ServletPathMatches;
+import io.undertow.util.CopyOnWriteMap;
+
+
+public class UndertowHTTPServerEngine implements ServerEngine {
+    
+    public static final String DO_NOT_CHECK_URL_PROP = "org.apache.cxf.transports.http_undertow.DontCheckUrl";
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(UndertowHTTPServerEngine.class);
+    
+    /**
+     * This is the network port for which this engine is allocated.
+     */
+    private int port;
+    
+    /**
+     * This is the network address for which this engine is allocated.
+     */
+    private String host;
+
+    /**
+     * This field holds the protocol for which this engine is 
+     * enabled, i.e. "http" or "https".
+     */
+    private String protocol = "http"; 
+    
+    private int servantCount;
+    
+    private Undertow server;
+    
+    /**
+     * This field holds the TLS ServerParameters that are programatically
+     * configured. The tlsServerParamers (due to JAXB) holds the struct
+     * placed by SpringConfig.
+     */
+    private TLSServerParameters tlsServerParameters;
+    
+    private SSLContext sslContext;
+    
+    /**
+     * This boolean signfies that SpringConfig is over. finalizeConfig
+     * has been called.
+     */
+    private boolean configFinalized;
+    
+    private ConcurrentMap<String, UndertowHTTPHandler> registedPaths = 
+        new CopyOnWriteMap<String, UndertowHTTPHandler>();
+
+    private boolean continuationsEnabled = true;
+
+    private ServletContext servletContext;
+    
+    private PathHandler path;
+    
+    private int maxIdleTime = 200000;
+    
+    private org.apache.cxf.transport.http_undertow.ThreadingParameters threadingParameters;
+    
+    private List<CXFUndertowHttpHandler> handlers;
+
+    public UndertowHTTPServerEngine(String host, int port) {
+        this.host = host;
+        this.port = port;
+    }
+
+    public UndertowHTTPServerEngine() {
+
+    }
+
+    @Override
+    public void addServant(URL url, UndertowHTTPHandler handler) {
+        if (shouldCheckUrl(handler.getBus())) {
+            checkRegistedContext(url);
+        }
+                
+        if (server == null) {
+            try {
+                // create a new undertow server instance if there is no server there
+                String contextName = HttpUriMapper.getContextName(url.getPath());
+                servletContext = buildServletContext(contextName);
+                handler.setServletContext(servletContext);
+                server = createServer(url, handler);
+                server.start();
+            } catch (Exception e) {
+                LOG.log(Level.SEVERE, "START_UP_SERVER_FAILED_MSG", new Object[] {e.getMessage(), port});
+                //problem starting server
+                try {                    
+                    server.stop();
+                } catch (Exception ex) {
+                    //ignore - probably wasn't fully started anyway
+                }
+                server = null;
+                throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage(), port), e);
+            }
+            
+        } else {
+            String contextName = HttpUriMapper.getContextName(url.getPath());
+            try {
+                servletContext = buildServletContext(contextName);
+            } catch (ServletException e) {
+                throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage(), port), e);
+            }
+            handler.setServletContext(servletContext);
+            
+            if (handler.isContextMatchExact()) {
+                path.addExactPath(url.getPath(), handler);
+            } else {
+                path.addPrefixPath(url.getPath(), handler);
+            }
+            
+        }
+        
+        final String smap = HttpUriMapper.getResourceBase(url.getPath());
+        handler.setName(smap);
+        registedPaths.put(url.getPath(), handler);
+        servantCount = servantCount + 1;
+    }
+    
+    
+    private ServletContext buildServletContext(String contextName) 
+        throws ServletException {
+        ServletContainer servletContainer = new ServletContainerImpl();
+        DeploymentInfo deploymentInfo = new DeploymentInfo();
+        deploymentInfo.setClassLoader(Thread.currentThread().getContextClassLoader());
+        deploymentInfo.setDeploymentName("cxf-undertow");
+        deploymentInfo.setContextPath(contextName);
+        ServletInfo asyncServlet = new ServletInfo(ServletPathMatches.DEFAULT_SERVLET_NAME, CxfUndertwoServlet.class);
+        deploymentInfo.addServlet(asyncServlet);
+        servletContainer.addDeployment(deploymentInfo);
+        DeploymentManager deploymentManager = servletContainer.getDeployment(deploymentInfo.getDeploymentName());
+        deploymentManager.deploy();
+        deploymentManager.start();
+        return deploymentManager.getDeployment().getServletContext();
+    }
+    
+    private Undertow createServer(URL url, UndertowHTTPHandler undertowHTTPHandler) throws Exception {
+        Undertow.Builder result = Undertow.builder();
+        result.setServerOption(UndertowOptions.IDLE_TIMEOUT, getMaxIdleTime());
+        if (tlsServerParameters != null) { 
+            if (this.sslContext == null) {
+                this.sslContext = createSSLContext();
+            }
+            result = result.addHttpsListener(getPort(), getHost(), this.sslContext);
+        } else {
+            result = result.addHttpListener(getPort(), getHost());
+        }
+        path = Handlers.path(new NotFoundHandler());
+        
+        if (url.getPath().length() == 0) {
+            result = result.setHandler(Handlers.trace(undertowHTTPHandler));
+        } else {
+            if (undertowHTTPHandler.isContextMatchExact()) {
+                path.addExactPath(url.getPath(), undertowHTTPHandler);
+            } else {
+                path.addPrefixPath(url.getPath(), undertowHTTPHandler);
+            }
+            
+            result = result.setHandler(wrapHandler(path));
+        }
+        
+        result = decorateUndertowSocketConnection(result);
+        result = disableSSLv3(result);
+        result = configureThreads(result);
+        return result.build();
+    }
+    
+    private Builder configureThreads(Builder builder) {
+        if (this.threadingParameters != null) {
+            if (this.threadingParameters.isWorkerIOThreadsSet()) {
+                builder = builder.setWorkerOption(Options.WORKER_IO_THREADS, 
+                              this.threadingParameters.getWorkerIOThreads());
+            }
+            if (this.threadingParameters.isMinThreadsSet()) {
+                builder = builder.setWorkerOption(Options.WORKER_TASK_CORE_THREADS, 
+                              this.threadingParameters.getMinThreads());
+            }
+            if (this.threadingParameters.isMaxThreadsSet()) {
+                builder = builder.setWorkerOption(Options.WORKER_TASK_MAX_THREADS, 
+                              this.threadingParameters.getMaxThreads());
+            }
+        }
+        return builder;
+    }
+
+    private HttpHandler wrapHandler(HttpHandler handler) {
+        HttpHandler nextHandler = handler;
+        for (CXFUndertowHttpHandler h : getHandlers()) {
+            h.setNext(nextHandler);
+            nextHandler = h;
+        }
+        return nextHandler;
+    }
+    
+    private Builder disableSSLv3(Builder result) {
+        //SSLv3 isn't safe, disable it by default unless explicitly use it
+        if (tlsServerParameters != null 
+            && ("SSLv3".equals(tlsServerParameters.getSecureSocketProtocol())
+                || !tlsServerParameters.getIncludeProtocols().isEmpty())) {
+            List<String> protocols = new LinkedList<String>(Arrays.asList("TLSv1", "TLSv1.1", "TLSv1.2", "SSLv3"));
+            for (String excludedProtocol : tlsServerParameters.getExcludeProtocols()) {
+                if (protocols.contains(excludedProtocol)) {
+                    protocols.remove(excludedProtocol);
+                }
+            }
+            Sequence<String> supportProtocols = Sequence.of(protocols);
+            return result.setSocketOption(Options.SSL_ENABLED_PROTOCOLS, supportProtocols);
+        } else {
+            Sequence<String> supportProtocols = Sequence.of("TLSv1", "TLSv1.1", "TLSv1.2");
+            return result.setSocketOption(Options.SSL_ENABLED_PROTOCOLS, supportProtocols);
+        }
+    }
+   
+
+    public Undertow.Builder decorateUndertowSocketConnection(Undertow.Builder builder) {
+        if (this.tlsServerParameters != null && this.tlsServerParameters.getClientAuthentication() != null 
+            && this.tlsServerParameters.getClientAuthentication().isRequired()) {
+            builder = builder.setSocketOption(Options.SSL_CLIENT_AUTH_MODE, SslClientAuthMode.REQUIRED);
+        }
+        if (this.tlsServerParameters != null && this.tlsServerParameters.getClientAuthentication() != null 
+            && this.tlsServerParameters.getClientAuthentication().isWant()) {
+            builder = builder.setSocketOption(Options.SSL_CLIENT_AUTH_MODE, SslClientAuthMode.REQUESTED);
+        }
+        return builder;
+    }
+
+    private boolean shouldCheckUrl(Bus bus) {
+        
+        Object prop = null;
+        if (bus != null) {
+            prop = bus.getProperty(DO_NOT_CHECK_URL_PROP);
+        }
+        if (prop == null) {
+            prop = SystemPropertyAction.getPropertyOrNull(DO_NOT_CHECK_URL_PROP);
+        }
+        return !PropertyUtils.isTrue(prop);
+    }
+    
+    protected void checkRegistedContext(URL url) {
+        
+        String urlPath = url.getPath();
+        for (String registedPath : registedPaths.keySet()) {
+            if (urlPath.equals(registedPath)) {
+                throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url, registedPath));
+            }
+            // There are some context path conflicts which could cause the UndertowHTTPServerEngine 
+            // doesn't route the message to the right UndertowHTTPHandler
+            if (urlPath.equals(HttpUriMapper.getContextName(registedPath))) {
+                throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url, registedPath));
+            }
+            if (registedPath.equals(HttpUriMapper.getContextName(urlPath))) {
+                throw new Fault(new Message("ADD_HANDLER_CONTEXT_CONFILICT_MSG", LOG, url, registedPath));
+            }
+        }
+        
+    }
+
+    @Override
+    public void removeServant(URL url) {
+        UndertowHTTPHandler handler = registedPaths.remove(url.getPath());
+        if (handler == null) {
+            return;
+        }       
+        --servantCount;
+        if (url.getPath().isEmpty()) {
+            return;
+        }
+        if (handler.isContextMatchExact()) {
+            path.removeExactPath(url.getPath());
+        } else {
+            path.removePrefixPath(url.getPath());
+        }
+    }
+
+    @Override
+    public UndertowHTTPHandler getServant(URL url) {
+        return registedPaths.get(url.getPath());
+    }
+
+    /**
+     * Returns the protocol "http" or "https" for which this engine
+     * was configured.
+     */
+    public String getProtocol() {
+        return protocol;
+    }
+    
+    /**
+     * Returns the port number for which this server engine was configured.
+     * @return
+     */
+    public int getPort() {
+        return port;
+    }
+    
+    /**
+     * Returns the host for which this server engine was configured.
+     * @return
+     */
+    public String getHost() {
+        return host;
+    }
+    
+    public void setPort(int p) {
+        port = p;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public void finalizeConfig() throws GeneralSecurityException,
+        IOException {
+        retrieveListenerFactory();
+        this.configFinalized = true;
+    }
+
+    /**
+     * This method is used to programmatically set the TLSServerParameters.
+     * This method may only be called by the factory.
+     * @throws IOException 
+     */
+    public void setTlsServerParameters(TLSServerParameters params) {
+        
+        tlsServerParameters = params;
+        if (this.configFinalized) {
+            this.retrieveListenerFactory();
+        }
+    }
+    
+    private void retrieveListenerFactory() {
+        if (tlsServerParameters != null) {
+            protocol = "https";
+            
+        } else {
+            protocol = "http";
+        }
+        LOG.fine("Configured port " + port + " for \"" + protocol + "\".");
+    }
+
+    
+    /**
+     * This method returns the programmatically set TLSServerParameters, not
+     * the TLSServerParametersType, which is the JAXB generated type used 
+     * in SpringConfiguration.
+     * @return
+     */
+    public TLSServerParameters getTlsServerParameters() {
+        return tlsServerParameters;
+    } 
+
+        
+    public void stop() {
+        if (this.server != null) {
+            this.server.stop();
+        }
+    }
+
+    /**
+     * This method will shut down the server engine and
+     * remove it from the factory's cache. 
+     */
+    public void shutdown() {
+        registedPaths.clear();
+        if (shouldDestroyPort()) {
+            if (servantCount == 0) {
+                UndertowHTTPServerEngineFactory.destroyForPort(port);
+            } else {
+                LOG.log(Level.WARNING, "FAILED_TO_SHUTDOWN_ENGINE_MSG", port);
+            }
+        }
+    }
+    
+    private boolean shouldDestroyPort() {
+        //if we shutdown the port, on SOME OS's/JVM's, if a client
+        //in the same jvm had been talking to it at some point and keep alives
+        //are on, then the port is held open for about 60 seconds
+        //afterwards and if we restart, connections will then 
+        //get sent into the old stuff where there are 
+        //no longer any servant registered.   They pretty much just hang.
+        
+        //this is most often seen in our unit/system tests that 
+        //test things in the same VM.
+        
+        String s = SystemPropertyAction
+                .getPropertyOrNull("org.apache.cxf.transports.http_undertow.DontClosePort." + port);
+        if (s == null) {
+            s = SystemPropertyAction
+                .getPropertyOrNull("org.apache.cxf.transports.http_undertow.DontClosePort");
+        }
+        return !Boolean.valueOf(s);
+    }
+    
+        
+    protected SSLContext createSSLContext() throws Exception  {
+        String proto = tlsServerParameters.getSecureSocketProtocol() == null
+            ? "TLS" : tlsServerParameters.getSecureSocketProtocol();
+                    
+        SSLContext context = tlsServerParameters.getJsseProvider() == null
+            ? SSLContext.getInstance(proto)
+                : SSLContext.getInstance(proto, tlsServerParameters.getJsseProvider());
+            
+        KeyManager keyManagers[] = tlsServerParameters.getKeyManagers();
+        if (tlsServerParameters.getCertAlias() != null) {
+            keyManagers = getKeyManagersWithCertAlias(keyManagers);
+        }
+        context.init(tlsServerParameters.getKeyManagers(), 
+                     tlsServerParameters.getTrustManagers(),
+                     tlsServerParameters.getSecureRandom());
+
+        return context;
+    }
+    
+    protected KeyManager[] getKeyManagersWithCertAlias(KeyManager keyManagers[]) throws Exception {
+        if (tlsServerParameters.getCertAlias() != null) {
+            for (int idx = 0; idx < keyManagers.length; idx++) {
+                if (keyManagers[idx] instanceof X509KeyManager) {
+                    keyManagers[idx] = new AliasedX509ExtendedKeyManager(
+                        tlsServerParameters.getCertAlias(), (X509KeyManager)keyManagers[idx]);
+                }
+            }
+        }
+        return keyManagers;
+    }
+
+    /**
+     * This method sets the threading parameters for this particular 
+     * server engine.
+     * This method may only be called by the factory.
+     */
+    public void setThreadingParameters(ThreadingParameters params) {        
+        threadingParameters = params;
+    }
+    
+    /**
+     * This method returns whether the threading parameters are set.
+     */
+    public boolean isSetThreadingParameters() {
+        return threadingParameters != null;
+    }
+    
+    /**
+     * This method returns the threading parameters that have been set.
+     * This method may return null, if the threading parameters have not
+     * been set.
+     */
+    public ThreadingParameters getThreadingParameters() {
+        return threadingParameters;
+    }
+
+    public void setContinuationsEnabled(boolean enabled) {
+        continuationsEnabled  = enabled;
+    }
+    
+    public boolean getContinuationsEnabled() {
+        return continuationsEnabled;
+    }
+
+    public int getMaxIdleTime() {
+        return maxIdleTime;
+    }
+
+    public void setMaxIdleTime(int maxIdleTime) {
+        this.maxIdleTime = maxIdleTime;
+    }
+    
+        
+    /**
+     * set the Undertow server's handlers
+     * @param h
+     */
+    
+    public void setHandlers(List<CXFUndertowHttpHandler> h) {
+        handlers = h;
+    }
+    
+    public List<CXFUndertowHttpHandler> getHandlers() {
+        return handlers != null ? handlers : new ArrayList<CXFUndertowHttpHandler>();
+    }
+}


Mime
View raw message