This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git
The following commit(s) were added to refs/heads/main by this push:
new 6732da5f6 camel-cxf with Jetty HTTP Transport (#634)
6732da5f6 is described below
commit 6732da5f6a50754b4e62cee6f1a4ebebae3fea39
Author: robinvish2794 <[email protected]>
AuthorDate: Wed Jul 2 13:18:57 2025 +0530
camel-cxf with Jetty HTTP Transport (#634)
---
components/camel-cxf/camel-cxf-all/pom.xml | 2 +-
components/camel-cxf/camel-cxf-spring-all/pom.xml | 2 +-
.../camel-cxf/camel-cxf-transport-jetty/pom.xml | 138 ++++++++
.../HTTPJettyTransportNamespaceHandler.java | 81 +++++
.../JettyHTTPServerEngineFactoryHolder.java | 263 +++++++++++++++
.../blueprint/JettyServerEngineFactoryParser.java | 133 ++++++++
.../jetty/blueprint/JettyServerEngineParser.java | 31 ++
.../jetty/osgi/HTTPJettyTransportActivator.java | 360 +++++++++++++++++++++
components/camel-cxf/pom.xml | 1 +
features/src/main/feature/camel-features.xml | 11 +-
pom.xml | 2 -
.../features/camel-cxf-jetty}/pom.xml | 20 +-
.../karaf/camel/test/jaxws/HelloService.java | 35 ++
.../main/resources/OSGI-INF/blueprint/route.xml | 41 +++
.../karaf/camel/itest/CamelCxfJettyITest.java | 75 +++++
tests/features/pom.xml | 1 +
16 files changed, 1171 insertions(+), 25 deletions(-)
diff --git a/components/camel-cxf/camel-cxf-all/pom.xml
b/components/camel-cxf/camel-cxf-all/pom.xml
index 5f883672f..2ccf79392 100644
--- a/components/camel-cxf/camel-cxf-all/pom.xml
+++ b/components/camel-cxf/camel-cxf-all/pom.xml
@@ -65,7 +65,7 @@
jakarta.xml.ws*;version="${camel-osgi-jakarta-xml-ws-version}",
jakarta.xml.bind*;version="${camel-osgi-jakarta-bind-version}",
jakarta.validation*;resolution:=optional;version="${camel-osgi-jakarta-validation-version}",
- jakarta.jws*;version="${camel-osgi-jakarta-jws-version}",
+ jakarta.jws*;version="${camel-osgi-jakarta-xml-ws-version}",
jakarta.ws.rs*;version="${camel-osgi-jakarta-ws-rs-version}",
jakarta.xml.soap*;version="${camel-osgi-saaj-version}",
jakarta.servlet*;version="${camel-osgi-jakarta-servlet-version}",
diff --git a/components/camel-cxf/camel-cxf-spring-all/pom.xml
b/components/camel-cxf/camel-cxf-spring-all/pom.xml
index 784f03c95..1d160d279 100644
--- a/components/camel-cxf/camel-cxf-spring-all/pom.xml
+++ b/components/camel-cxf/camel-cxf-spring-all/pom.xml
@@ -52,7 +52,7 @@
jakarta.xml.ws*;version="${camel-osgi-jakarta-xml-ws-version}",
jakarta.xml.bind*;version="${camel-osgi-jakarta-bind-version}",
jakarta.validation*;resolution:=optional;version="${camel-osgi-jakarta-validation-version}",
- jakarta.jws*;version="${camel-osgi-jakarta-jws-version}",
+ jakarta.jws*;version="${camel-osgi-jakarta-xml-ws-version}",
jakarta.ws.rs*;version="${camel-osgi-jakarta-ws-rs-version}",
jakarta.xml.soap*;version="${camel-osgi-saaj-version}",
jakarta.servlet*;version="${camel-osgi-jakarta-servlet-version}",
diff --git a/components/camel-cxf/camel-cxf-transport-jetty/pom.xml
b/components/camel-cxf/camel-cxf-transport-jetty/pom.xml
new file mode 100644
index 000000000..dc10aef45
--- /dev/null
+++ b/components/camel-cxf/camel-cxf-transport-jetty/pom.xml
@@ -0,0 +1,138 @@
+<?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.
+
+-->
+<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>
+
+ <parent>
+ <groupId>org.apache.camel.karaf</groupId>
+ <artifactId>camel-cxf-parent</artifactId>
+ <version>4.10.6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-cxf-transport-jetty</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Camel :: Karaf :: Components :: CXF :: Transport Jetty</name>
+
+ <properties>
+ <camel.osgi.export>
+
org.apache.camel.component.cxf.transport.jetty*;version=${camel-version},
+ org.apache.cxf.transport.http_jetty*;version=${cxf-version},
+ org.apache.cxf.transports.http_jetty*;version=${cxf-version}
+ </camel.osgi.export>
+
<camel.osgi.activator>org.apache.camel.component.cxf.transport.jetty.osgi.HTTPJettyTransportActivator</camel.osgi.activator>
+ <camel.osgi.import>
+
jakarta.annotation;version="${camel-osgi-jakarta-annotation2-version}",
+ jakarta.servlet*;version="${camel-osgi-jakarta-servlet-version}",
+ jakarta.xml.bind*;version="${camel-osgi-jakarta-bind-version}",
+ javax.management*,
+ javax.net*,
+ javax.xml*,
+ org.apache.aries.blueprint*,
+ org.apache.cxf.*;version="${camel-osgi-cxf-version}",
+ org.eclipse.jetty*;resolution:=optional;version="${jetty-version}",
+ org.osgi.framework*,
+ org.osgi.service*,
+ org.osgi.util*,
+ org.slf4j,
+ org.w3c*
+ </camel.osgi.import>
+ <camel.osgi.export.service>
+
org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace="http://cxf.apache.org/transports/http-jetty/configuration"
+ </camel.osgi.export.service>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-jetty</artifactId>
+ <version>${cxf-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- OSGi, Blueprint -->
+ <dependency>
+ <groupId>org.apache.camel.karaf</groupId>
+ <artifactId>camel-cxf-blueprint</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.karaf</groupId>
+ <artifactId>camel-cxf-all</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>../../../src/main/resources</directory>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+
<include>org.apache.cxf:cxf-rt-transports-http-jetty</include>
+ </includes>
+ </artifactSet>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/HTTPJettyTransportNamespaceHandler.java
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/HTTPJettyTransportNamespaceHandler.java
new file mode 100644
index 000000000..16df2c824
--- /dev/null
+++
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/HTTPJettyTransportNamespaceHandler.java
@@ -0,0 +1,81 @@
+/**
+ * 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.camel.component.cxf.transport.jetty.blueprint;
+
+import org.apache.aries.blueprint.Namespaces;
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.camel.component.cxf.blueprint.helpers.BaseNamespaceHandler;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import java.net.URL;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+@Namespaces("http://cxf.apache.org/transports/http-jetty/configuration")
+public class HTTPJettyTransportNamespaceHandler extends BaseNamespaceHandler {
+
+ public static final String JETTY_TRANSPORT =
"http://cxf.apache.org/transports/http-jetty/configuration";
+
+ private static final String JETTY_ENGINE = "engine";
+
+ private static final String JETTY_ENGINE_FACTORY = "engine-factory";
+
+ private static final Logger LOG =
LogUtils.getL7dLogger(HTTPJettyTransportNamespaceHandler.class);
+
+ public URL getSchemaLocation(String s) {
+ if (JETTY_TRANSPORT.equals(s)) {
+ return getClass().getClassLoader().
+ getResource("schemas/configuration/http-jetty.xsd");
+ }
+ return super.findCoreSchemaLocation(s);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+
+ public Metadata parse(Element element, ParserContext parserContext) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Parsing element {{" + element.getNamespaceURI() + "}}{"
+ element.getLocalName() + "}");
+ }
+
+ if (JETTY_ENGINE.equals(element.getLocalName())) {
+ //This doesn't hit normal configs.
+ return new JettyServerEngineParser().parse(element, parserContext);
+ } else if (JETTY_ENGINE_FACTORY.equals(element.getLocalName())) {
+
+ return new JettyServerEngineFactoryParser().parse(element,
parserContext);
+ }
+
+ return null;
+ }
+
+ public ComponentMetadata decorate(Node node,
+ ComponentMetadata componentMetadata,
+ ParserContext parserContext) {
+ LOG.info("Decorating node " + node + " " + componentMetadata);
+ return componentMetadata;
+ }
+}
diff --git
a/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
new file mode 100644
index 000000000..941423a09
--- /dev/null
+++
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyHTTPServerEngineFactoryHolder.java
@@ -0,0 +1,263 @@
+/**
+ * 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.camel.component.cxf.transport.jetty.blueprint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.jaxb.JAXBContextCache;
+import org.apache.cxf.common.jaxb.JAXBUtils;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.configuration.jsse.TLSServerParametersConfig;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory;
+import org.apache.cxf.transport.http_jetty.ThreadingParameters;
+import org.apache.cxf.transports.http_jetty.configuration.*;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.w3c.dom.Element;
+
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.JAXBElement;
+import jakarta.xml.bind.JAXBException;
+import java.io.StringReader;
+import java.util.*;
+import java.util.logging.Logger;
+
+public class JettyHTTPServerEngineFactoryHolder {
+
+ private static final Logger LOG =
LogUtils.getL7dLogger(JettyHTTPServerEngineFactoryHolder.class);
+
+ private String parsedElement;
+ private JettyHTTPServerEngineFactory factory;
+
+ private Map<String, Connector> connectorMap;
+
+ private Map<String, List<Handler>> handlersMap;
+
+ private JAXBContext jaxbContext;
+ private Set<Class<?>> jaxbClasses;
+
+ public JettyHTTPServerEngineFactoryHolder() {
+ }
+
+ public void init() {
+ try {
+ Element element = StaxUtils.read(new
StringReader(parsedElement)).getDocumentElement();
+
+ JettyHTTPServerEngineFactoryConfigType config
+ = getJaxbObject(element,
+ JettyHTTPServerEngineFactoryConfigType.class);
+
+ Bus defaultBus = BusFactory.getDefaultBus();
+ factory = new JettyHTTPServerEngineFactory(defaultBus);
+
+ Map<String, ThreadingParameters> threadingParametersMap
+ = new TreeMap<>();
+
+ if (config.getIdentifiedThreadingParameters() != null) {
+ for (ThreadingParametersIdentifiedType threads :
config.getIdentifiedThreadingParameters()) {
+ ThreadingParameters rThreads = new ThreadingParameters();
+ String id = threads.getId();
+ if (threads.getThreadingParameters().getMaxThreads() !=
null) {
+
rThreads.setMaxThreads(threads.getThreadingParameters().getMaxThreads());
+ }
+ if (threads.getThreadingParameters().getMinThreads() !=
null) {
+
rThreads.setMinThreads(threads.getThreadingParameters().getMinThreads());
+ }
+
rThreads.setThreadNamePrefix(threads.getThreadingParameters().getThreadNamePrefix());
+ threadingParametersMap.put(id, rThreads);
+ }
+
+ factory.setThreadingParametersMap(threadingParametersMap);
+ }
+
+ //SSL
+ Map<String, TLSServerParameters> sslMap = new TreeMap<>();
+ if (config.getIdentifiedTLSServerParameters() != null) {
+
+ for (TLSServerParametersIdentifiedType t :
config.getIdentifiedTLSServerParameters()) {
+ try {
+ TLSServerParameters parameter
+ = new
TLSServerParametersConfig(t.getTlsServerParameters());
+ sslMap.put(t.getId(), parameter);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not configure TLS
for id " + t.getId(), e);
+ }
+ }
+ factory.setTlsServerParametersMap(sslMap);
+ }
+ //Engines
+
+ List<JettyHTTPServerEngine> engineList = new ArrayList<>();
+ for (JettyHTTPServerEngineConfigType engine : config.getEngine()) {
+ JettyHTTPServerEngine eng = new JettyHTTPServerEngine(
+ factory.getMBeanContainer(), engine.getHost(),
engine.getPort());
+ if (engine.getConnector() != null && connectorMap != null) {
+ // we need to setup the Connector from the connectorMap
+ Connector connector =
connectorMap.get(engine.getPort().toString());
+ if (connector != null) {
+ eng.setConnector(connector);
+ } else {
+ throw new RuntimeException("Could not find the
connector instance for engine with port"
+ + engine.getPort().toString());
+ }
+ }
+ if (engine.getHandlers() != null && handlersMap != null) {
+ List<Handler> handlers =
handlersMap.get(engine.getPort().toString());
+ if (handlers != null) {
+ eng.setHandlers(handlers);
+ } else {
+ throw new RuntimeException("Could not find the
handlers instance for engine with port"
+ + engine.getPort().toString());
+ }
+ }
+
+ if (engine.isContinuationsEnabled() != null) {
+
eng.setContinuationsEnabled(engine.isContinuationsEnabled());
+ }
+ if (engine.isSendServerVersion() != null) {
+ eng.setSendServerVersion(engine.isSendServerVersion());
+ }
+ if (engine.getHost() != null &&
!StringUtils.isEmpty(engine.getHost())) {
+ eng.setHost(engine.getHost());
+ }
+ if (engine.getMaxIdleTime() != null) {
+ eng.setMaxIdleTime(engine.getMaxIdleTime());
+ }
+ if (engine.getPort() != null) {
+ eng.setPort(engine.getPort());
+ }
+ if (engine.isReuseAddress() != null) {
+ eng.setReuseAddress(engine.isReuseAddress());
+ }
+ if (engine.isSessionSupport() != null) {
+ eng.setSessionSupport(engine.isSessionSupport());
+ }
+ if (engine.getSessionTimeout() != null) {
+
eng.setSessionTimeout(engine.getSessionTimeout().intValue());
+ }
+ if (engine.getThreadingParameters() != null) {
+ ThreadingParametersType threads =
engine.getThreadingParameters();
+ ThreadingParameters rThreads = new ThreadingParameters();
+ if (threads.getMaxThreads() != null) {
+ rThreads.setMaxThreads(threads.getMaxThreads());
+ }
+ if (threads.getMinThreads() != null) {
+ rThreads.setMinThreads(threads.getMinThreads());
+ }
+
+ eng.setThreadingParameters(rThreads);
+ }
+
+ //eng.setServer(engine.getTlsServerParameters());
+ if (engine.getTlsServerParameters() != null
+ && (engine.getTlsServerParameters().getKeyManagers() !=
null
+ || engine.getTlsServerParameters().getTrustManagers() !=
null)) {
+ try {
+ TLSServerParameters parameter =
+ new
TLSServerParametersConfig(engine.getTlsServerParameters());
+ eng.setTlsServerParameters(parameter);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not configure TLS
for engine on "
+ + eng.getHost() + ":" + eng.getPort(), e);
+ }
+ }
+ eng.finalizeConfig();
+
+ engineList.add(eng);
+ }
+ factory.setEnginesList(engineList);
+ //Unravel this completely.
+
+ factory.initComplete();
+ } catch (Exception e) {
+ throw new RuntimeException("Could not process configuration.", e);
+ }
+ }
+
+ public void destroy() {
+ // need to release the reference of the jaxb Classes
+ factory.postShutdown();
+ jaxbClasses.clear();
+ jaxbContext = null;
+ }
+
+ public String getParsedElement() {
+ return parsedElement;
+ }
+
+ public void setParsedElement(String parsedElement) {
+ this.parsedElement = parsedElement;
+ }
+
+ public void setConnectorMap(Map<String, Connector> connectorMap) {
+ this.connectorMap = connectorMap;
+ }
+
+ public void setHandlersMap(Map<String, List<Handler>> handlersMap) {
+ this.handlersMap = handlersMap;
+ }
+
+ protected <T> T getJaxbObject(Element parent, Class<T> c) {
+
+ try {
+ JAXBElement<T> ele = JAXBUtils.unmarshall(getContext(c), parent,
c);
+ return ele.getValue();
+ } catch (JAXBException e) {
+ LOG.warning("Unable to parse property due to " + e);
+ return null;
+ }
+ }
+
+ protected synchronized JAXBContext getContext(Class<?> cls) {
+ if (jaxbContext == null || jaxbClasses == null ||
!jaxbClasses.contains(cls)) {
+ try {
+ Set<Class<?>> tmp = new HashSet<>();
+ if (jaxbClasses != null) {
+ tmp.addAll(jaxbClasses);
+ }
+ JAXBContextCache.addPackage(tmp,
PackageUtils.getPackageName(cls),
+ cls == null ?
getClass().getClassLoader() : cls.getClassLoader());
+ if (cls != null) {
+ boolean hasOf = false;
+ for (Class<?> c : tmp) {
+ if (c.getPackage() == cls.getPackage() &&
"ObjectFactory".equals(c.getSimpleName())) {
+ hasOf = true;
+ }
+ }
+ if (!hasOf) {
+ tmp.add(cls);
+ }
+ }
+ JAXBContextCache.scanPackages(tmp);
+ JAXBContextCache.CachedContextAndSchemas ccs
+ = JAXBContextCache.getCachedContextAndSchemas(tmp, null,
null, null, false);
+ jaxbClasses = ccs.getClasses();
+ jaxbContext = ccs.getContext();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return jaxbContext;
+ }
+}
diff --git
a/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineFactoryParser.java
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineFactoryParser.java
new file mode 100644
index 000000000..43b2ce652
--- /dev/null
+++
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineFactoryParser.java
@@ -0,0 +1,133 @@
+/**
+ * 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.camel.component.cxf.transport.jetty.blueprint;
+
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutableMapMetadata;
+import org.apache.cxf.common.util.StringUtils;
+import
org.apache.camel.component.cxf.blueprint.configuration.AbstractBPBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.w3c.dom.Element;
+
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.UUID;
+
+public class JettyServerEngineFactoryParser extends
AbstractBPBeanDefinitionParser {
+
+ public static final String JETTY_TRANSPORT =
"http://cxf.apache.org/transports/http-jetty/configuration";
+
+ public static final String JETTY_THREADING =
"http://cxf.apache.org/configuration/parameterized-types";
+
+ public static String getIdOrName(Element elem) {
+ String id = elem.getAttribute("id");
+
+ if (null == id || "".equals(id)) {
+ String names = elem.getAttribute("name");
+ if (null != names) {
+ StringTokenizer st = new StringTokenizer(names, ",");
+ if (st.countTokens() > 0) {
+ id = st.nextToken();
+ }
+ }
+ }
+ return id;
+ }
+
+ public Metadata parse(Element element, ParserContext context) {
+
+ //Endpoint definition
+ MutableBeanMetadata ef =
context.createMetadata(MutableBeanMetadata.class);
+ if (!StringUtils.isEmpty(getIdOrName(element))) {
+ ef.setId(getIdOrName(element));
+ } else {
+ ef.setId("jetty.engine.factory-holder-" +
UUID.randomUUID().toString());
+ }
+ ef.setRuntimeClass(JettyHTTPServerEngineFactoryHolder.class);
+
+ // setup the ConnectorMap and HandlersMap property for the
JettyHTTPServerEngineFactoryHolder
+
+ try {
+ // Print the DOM node
+ String xmlString = StaxUtils.toString(element);
+ ef.addProperty("parsedElement", createValue(context, xmlString));
+ ef.setInitMethod("init");
+ ef.setActivation(ComponentMetadata.ACTIVATION_EAGER);
+ ef.setDestroyMethod("destroy");
+
+ // setup the EngineConnector
+ List<Element> engines = DOMUtils
+ .getChildrenWithName(element,
HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT, "engine");
+ ef.addProperty("connectorMap", parseEngineConnector(engines, ef,
context));
+ ef.addProperty("handlersMap", parseEngineHandlers(engines, ef,
context));
+ return ef;
+ } catch (Exception e) {
+ throw new RuntimeException("Could not process configuration.", e);
+ }
+ }
+
+ protected Metadata parseEngineConnector(List<Element> engines,
ComponentMetadata enclosingComponent,
+ ParserContext context) {
+ MutableMapMetadata map =
context.createMetadata(MutableMapMetadata.class);
+ map.setKeyType("java.lang.String");
+ map.setValueType("org.eclipse.jetty.server.Connector");
+
+ for (Element engine : engines) {
+ String port = engine.getAttribute("port");
+ ValueMetadata keyValue = createValue(context, port);
+ Element connector = DOMUtils
+ .getFirstChildWithName(engine,
HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT,
+ "connector");
+ if (connector != null) {
+ Element first = DOMUtils.getFirstElement(connector);
+ Metadata valValue = context.parseElement(Metadata.class,
enclosingComponent, first);
+ map.addEntry(keyValue, valValue);
+ }
+ }
+
+ return map;
+ }
+
+ protected Metadata parseEngineHandlers(List<Element> engines,
ComponentMetadata enclosingComponent,
+ ParserContext context) {
+ MutableMapMetadata map =
context.createMetadata(MutableMapMetadata.class);
+ map.setKeyType("java.lang.String");
+ map.setValueType("java.util.List");
+
+ for (Element engine : engines) {
+ String port = engine.getAttribute("port");
+ ValueMetadata keyValue = createValue(context, port);
+ Element handlers = DOMUtils
+ .getFirstChildWithName(engine,
HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT,
+ "handlers");
+ if (handlers != null) {
+ Metadata valValue = parseListData(context, enclosingComponent,
handlers);
+ map.addEntry(keyValue, valValue);
+ }
+ }
+ return map;
+ }
+
+
+}
diff --git
a/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineParser.java
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineParser.java
new file mode 100644
index 000000000..a24bee028
--- /dev/null
+++
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/blueprint/JettyServerEngineParser.java
@@ -0,0 +1,31 @@
+/**
+ * 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.camel.component.cxf.transport.jetty.blueprint;
+
+import org.apache.aries.blueprint.ParserContext;
+import
org.apache.camel.component.cxf.blueprint.configuration.AbstractBPBeanDefinitionParser;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.w3c.dom.Element;
+
+public class JettyServerEngineParser extends AbstractBPBeanDefinitionParser {
+
+ public Metadata parse(Element element, ParserContext context) {
+ return null;
+ }
+}
diff --git
a/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/osgi/HTTPJettyTransportActivator.java
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/osgi/HTTPJettyTransportActivator.java
new file mode 100644
index 000000000..e31ee6bb6
--- /dev/null
+++
b/components/camel-cxf/camel-cxf-transport-jetty/src/main/java/org/apache/camel/component/cxf/transport/jetty/osgi/HTTPJettyTransportActivator.java
@@ -0,0 +1,360 @@
+package org.apache.camel.component.cxf.transport.jetty.osgi;
+
+import
org.apache.camel.component.cxf.blueprint.bus.BlueprintNameSpaceHandlerFactory;
+import org.apache.camel.component.cxf.blueprint.bus.NamespaceHandlerRegisterer;
+import
org.apache.camel.component.cxf.transport.jetty.blueprint.HTTPJettyTransportNamespaceHandler;
+import org.apache.cxf.common.util.CollectionUtils;
+import org.apache.cxf.configuration.jsse.TLSParameterJaxBUtils;
+import org.apache.cxf.configuration.jsse.TLSServerParameters;
+import org.apache.cxf.configuration.security.*;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory;
+import org.apache.cxf.transport.http_jetty.ThreadingParameters;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.osgi.util.tracker.ServiceTracker;
+
+import javax.management.MBeanServer;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+
+public class HTTPJettyTransportActivator
+ implements BundleActivator, ManagedServiceFactory {
+ public static final String FACTORY_PID = "org.apache.cxf.http.jetty";
+
+ BundleContext context;
+ MBeanServer mbeans;
+ ServiceTracker<MBeanServer, ?> mbeanServerTracker;
+ ServiceRegistration<ManagedServiceFactory> reg;
+
+ JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory() {
+ public MBeanServer getMBeanServer() {
+ return (MBeanServer) mbeanServerTracker.getService();
+ }
+ };
+
+ public void start(BundleContext ctx) throws Exception {
+ this.context = ctx;
+ mbeanServerTracker = new ServiceTracker<>(ctx, MBeanServer.class,
null);
+
+ BlueprintNameSpaceHandlerFactory factory = new
BlueprintNameSpaceHandlerFactory() {
+
+ @Override
+ public Object createNamespaceHandler() {
+ return new HTTPJettyTransportNamespaceHandler();
+ }
+ };
+
+ NamespaceHandlerRegisterer.register(context, factory,
+ "http://cxf.apache.org/transports/http-jetty/configuration");
+
+ reg = context.registerService(ManagedServiceFactory.class,
+ this,
+ CollectionUtils.singletonDictionary(Constants.SERVICE_PID,
FACTORY_PID));
+
+ }
+
+ public void stop(BundleContext ctx) throws Exception {
+ mbeanServerTracker.close();
+ reg.unregister();
+ }
+
+ public String getName() {
+ return FACTORY_PID;
+ }
+
+ public void updated(String pid, Dictionary<String, ?> properties)
+ throws ConfigurationException {
+ if (pid == null) {
+ return;
+ }
+ int port = Integer.parseInt((String) properties.get("port"));
+
+ String host = (String) properties.get("host");
+ try {
+ TLSServerParameters tls = createTlsServerParameters(properties);
+ if (tls != null) {
+ factory.setTLSServerParametersForPort(host, port, tls);
+ } else {
+ factory.createJettyHTTPServerEngine(host, port, "http");
+ }
+
+ JettyHTTPServerEngine e =
factory.retrieveJettyHTTPServerEngine(port);
+ configure(e, properties);
+ } catch (GeneralSecurityException | IOException e) {
+ throw new ConfigurationException(null, null, e);
+ }
+ }
+
+
+ private void configure(JettyHTTPServerEngine e, Dictionary<String, ?>
properties) {
+ ThreadingParameters threading = createThreadingParameters(properties);
+ if (threading != null) {
+ e.setThreadingParameters(threading);
+ }
+ Enumeration<String> keys = properties.keys();
+ while (keys.hasMoreElements()) {
+ String k = keys.nextElement();
+ if ("sessionSupport".equals(k)) {
+ e.setSessionSupport(Boolean.parseBoolean((String)
properties.get(k)));
+ } else if ("continuationsEnabled".equals(k)) {
+ e.setContinuationsEnabled(Boolean.parseBoolean((String)
properties.get(k)));
+ } else if ("sendServerVersion".equals(k)) {
+ e.setSendServerVersion(Boolean.parseBoolean((String)
properties.get(k)));
+ } else if ("reuseAddress".equals(k)) {
+ e.setReuseAddress(Boolean.parseBoolean((String)
properties.get(k)));
+ } else if ("maxIdleTime".equals(k)) {
+ e.setMaxIdleTime(Integer.parseInt((String) properties.get(k)));
+ } else if ("sessionTimeout".equals(k)) {
+ e.setSessionTimeout(Integer.parseInt((String)
properties.get(k)));
+ }
+ }
+ }
+
+ public void deleted(String pid) {
+ }
+
+ private ThreadingParameters createThreadingParameters(Dictionary<String,
?> d) {
+ Enumeration<String> keys = d.keys();
+ ThreadingParameters p = null;
+ while (keys.hasMoreElements()) {
+ String k = keys.nextElement();
+ if (k.startsWith("threadingParameters.")) {
+ if (p == null) {
+ p = new ThreadingParameters();
+ }
+ String v = (String) d.get(k);
+ k = k.substring("threadingParameters.".length());
+ if ("minThreads".equals(k)) {
+ p.setMinThreads(Integer.parseInt(v));
+ } else if ("maxThreads".equals(k)) {
+ p.setMaxThreads(Integer.parseInt(v));
+ } else if ("threadNamePrefix".equals(k)) {
+ p.setThreadNamePrefix(k);
+ }
+ }
+ }
+ return p;
+ }
+
+ private TLSServerParameters createTlsServerParameters(Dictionary<String,
?> d) {
+ Enumeration<String> keys = d.keys();
+ TLSServerParameters p = null;
+ SecureRandomParameters srp = null;
+ KeyManagersType kmt = null;
+ TrustManagersType tmt = null;
+ boolean enableRevocation = false;
+ while (keys.hasMoreElements()) {
+ String k = keys.nextElement();
+ if (k.startsWith("tlsServerParameters.")) {
+ if (p == null) {
+ p = new TLSServerParameters();
+ }
+ String v = (String) d.get(k);
+ k = k.substring("tlsServerParameters.".length());
+
+ if ("secureSocketProtocol".equals(k)) {
+ p.setSecureSocketProtocol(v);
+ } else if ("jsseProvider".equals(k)) {
+ p.setJsseProvider(v);
+ } else if ("certAlias".equals(k)) {
+ p.setCertAlias(v);
+ } else if ("clientAuthentication.want".equals(k)) {
+ if (p.getClientAuthentication() == null) {
+ p.setClientAuthentication(new ClientAuthentication());
+ }
+
p.getClientAuthentication().setWant(Boolean.parseBoolean(v));
+ } else if ("clientAuthentication.required".equals(k)) {
+ if (p.getClientAuthentication() == null) {
+ p.setClientAuthentication(new ClientAuthentication());
+ }
+
p.getClientAuthentication().setRequired(Boolean.parseBoolean(v));
+ } else if ("enableRevocation".equals(k)) {
+ enableRevocation = Boolean.parseBoolean(v);
+ } else if (k.startsWith("certConstraints.")) {
+ configureCertConstraints(p, k, v);
+ } else if (k.startsWith("secureRandomParameters.")) {
+ srp = configureSecureRandom(srp, k, v);
+ } else if (k.startsWith("cipherSuitesFilter.")) {
+ configureCipherSuitesFilter(p, k, v);
+ } else if (k.startsWith("cipherSuites")) {
+ StringTokenizer st = new StringTokenizer(v, ",");
+ while (st.hasMoreTokens()) {
+ p.getCipherSuites().add(st.nextToken());
+ }
+ } else if (k.startsWith("excludeProtocols")) {
+ StringTokenizer st = new StringTokenizer(v, ",");
+ while (st.hasMoreTokens()) {
+ p.getExcludeProtocols().add(st.nextToken());
+ }
+ } else if (k.startsWith("trustManagers.")) {
+ tmt = getTrustManagers(tmt,
+ k.substring("trustManagers.".length()),
+ v);
+ } else if (k.startsWith("keyManagers.")) {
+ kmt = getKeyManagers(kmt,
+ k.substring("keyManagers.".length()),
+ v);
+ }
+ }
+ }
+
+ try {
+ if (srp != null) {
+ p.setSecureRandom(TLSParameterJaxBUtils.getSecureRandom(srp));
+ }
+ if (kmt != null) {
+ p.setKeyManagers(TLSParameterJaxBUtils.getKeyManagers(kmt));
+ }
+ if (tmt != null) {
+ p.setTrustManagers(TLSParameterJaxBUtils.getTrustManagers(tmt,
enableRevocation));
+ }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return p;
+ }
+
+ private void configureCipherSuitesFilter(TLSServerParameters p, String k,
String v) {
+ k = k.substring("cipherSuitesFilter.".length());
+ StringTokenizer st = new StringTokenizer(v, ",");
+ FiltersType ft = p.getCipherSuitesFilter();
+ if (ft == null) {
+ ft = new FiltersType();
+ p.setCipherSuitesFilter(ft);
+ }
+ List<String> lst = "include".equals(k) ? ft.getInclude() :
ft.getExclude();
+ while (st.hasMoreTokens()) {
+ lst.add(st.nextToken());
+ }
+ }
+
+ private SecureRandomParameters
configureSecureRandom(SecureRandomParameters srp, String k, String v) {
+ k = k.substring("secureRandomParameters.".length());
+ if (srp == null) {
+ srp = new SecureRandomParameters();
+ }
+ if ("algorithm".equals(k)) {
+ srp.setAlgorithm(v);
+ } else if ("provider".equals(k)) {
+ srp.setProvider(v);
+ }
+ return srp;
+ }
+
+ private void configureCertConstraints(TLSServerParameters p, String k,
String v) {
+ k = k.substring("certConstraints.".length());
+ CertificateConstraintsType cct = p.getCertConstraints();
+ if (cct == null) {
+ cct = new CertificateConstraintsType();
+ p.setCertConstraints(cct);
+ }
+ DNConstraintsType dnct = null;
+ if (k.startsWith("SubjectDNConstraints.")) {
+ dnct = cct.getSubjectDNConstraints();
+ if (dnct == null) {
+ dnct = new DNConstraintsType();
+ cct.setSubjectDNConstraints(dnct);
+ }
+ k = k.substring("SubjectDNConstraints.".length());
+ } else if (k.startsWith("IssuerDNConstraints.")) {
+ dnct = cct.getIssuerDNConstraints();
+ if (dnct == null) {
+ dnct = new DNConstraintsType();
+ cct.setIssuerDNConstraints(dnct);
+ }
+ k = k.substring("IssuerDNConstraints.".length());
+ }
+ if (dnct != null) {
+ if ("combinator".equals(k)) {
+ dnct.setCombinator(CombinatorType.fromValue(v));
+ } else if ("RegularExpression".equals(k)) {
+ dnct.getRegularExpression().add(k);
+ }
+ }
+ }
+
+ private KeyManagersType getKeyManagers(KeyManagersType keyManagers, String
k, String v) {
+ if (keyManagers == null) {
+ keyManagers = new KeyManagersType();
+ }
+ if ("factoryAlgorithm".equals(k)) {
+ keyManagers.setFactoryAlgorithm(v);
+ } else if ("provider".equals(k)) {
+ keyManagers.setProvider(v);
+ } else if ("keyPassword".equals(k)) {
+ keyManagers.setKeyPassword(v);
+ } else if (k.startsWith("keyStore.")) {
+ keyManagers.setKeyStore(getKeyStore(keyManagers.getKeyStore(),
+ k.substring("keyStore.".length()),
+ v));
+ }
+ return keyManagers;
+ }
+
+ private KeyStoreType getKeyStore(KeyStoreType ks, String k, String v) {
+ if (ks == null) {
+ ks = new KeyStoreType();
+ }
+ if ("type".equals(k)) {
+ ks.setType(v);
+ } else if ("password".equals(k)) {
+ ks.setPassword(v);
+ } else if ("provider".equals(k)) {
+ ks.setProvider(v);
+ } else if ("url".equals(k)) {
+ ks.setUrl(v);
+ } else if ("file".equals(k)) {
+ ks.setFile(v);
+ } else if ("resource".equals(k)) {
+ ks.setResource(v);
+ }
+ return ks;
+ }
+
+ private TrustManagersType getTrustManagers(TrustManagersType tmt, String
k, String v) {
+ if (tmt == null) {
+ tmt = new TrustManagersType();
+ }
+ if ("provider".equals(k)) {
+ tmt.setProvider(v);
+ } else if ("factoryAlgorithm".equals(k)) {
+ tmt.setFactoryAlgorithm(v);
+ } else if (k.startsWith("keyStore.")) {
+ tmt.setKeyStore(getKeyStore(tmt.getKeyStore(),
+ k.substring("keyStore.".length()),
+ v));
+ } else if (k.startsWith("certStore")) {
+ tmt.setCertStore(getCertStore(tmt.getCertStore(),
+ k.substring("certStore.".length()),
+ v));
+ }
+ return tmt;
+ }
+
+ private CertStoreType getCertStore(CertStoreType cs, String k, String v) {
+ if (cs == null) {
+ cs = new CertStoreType();
+ }
+ if ("file".equals(k)) {
+ cs.setFile(v);
+ } else if ("url".equals(k)) {
+ cs.setUrl(v);
+ } else if ("resource".equals(k)) {
+ cs.setResource(v);
+ }
+ return cs;
+ }
+
+
+}
diff --git a/components/camel-cxf/pom.xml b/components/camel-cxf/pom.xml
index 9da8cbf6b..c659b1ba2 100644
--- a/components/camel-cxf/pom.xml
+++ b/components/camel-cxf/pom.xml
@@ -38,6 +38,7 @@
<module>camel-cxf-spring-all</module>
<module>camel-cxf-blueprint</module>
<module>camel-cxf-transport-blueprint</module>
+ <module>camel-cxf-transport-jetty</module>
</modules>
</project>
\ No newline at end of file
diff --git a/features/src/main/feature/camel-features.xml
b/features/src/main/feature/camel-features.xml
index 876dd5e42..277cfc598 100644
--- a/features/src/main/feature/camel-features.xml
+++ b/features/src/main/feature/camel-features.xml
@@ -54,10 +54,6 @@
<bundle
dependency="true">mvn:jakarta.validation/jakarta.validation-api/${jakarta-validation-api-version}</bundle>
</feature>
- <feature name="jakarta-jws" version="${jakarta-jws-api-version}">
- <bundle
dependency="true">mvn:jakarta.jws/jakarta.jws-api/${jakarta-jws-api-version}</bundle>
- </feature>
-
<feature name="jaxb-runtime" version="${jaxb3-core-version}">
<feature version="[3,4)">jakarta-xml-bind</feature>
<bundle
dependency="true">mvn:com.sun.xml.bind/jaxb-core/${jaxb3-core-version}</bundle>
@@ -936,7 +932,6 @@
<feature version='${camel-osgi-version-range}'>camel-spring</feature>
<feature
version="${camel-osgi-jakarta-annotation2-version}">jakarta-annotation</feature>
<feature version="[6,7)">jakarta-servlet</feature>
- <feature
version="${camel-osgi-jakarta-jws-version}">jakarta-jws</feature>
<feature version="[3,4)">jakarta-validation</feature>
<bundle
dependency="true">mvn:org.glassfish.hk2/osgi-resource-locator/${osgi-resource-locator-version}</bundle>
<bundle
dependency="true">mvn:org.apache.neethi/neethi/${auto-detect-version}</bundle>
@@ -950,6 +945,12 @@
<bundle>mvn:org.apache.camel.karaf/camel-cxf-blueprint/${project.version}</bundle>
<bundle>mvn:org.apache.camel.karaf/camel-cxf-transport-blueprint/${project.version}</bundle>
</feature>
+ <feature name='camel-cxf-jetty' version='${project.version}'
start-level='50'>
+ <feature version="[12,13)">jetty</feature>
+ <feature version='${camel-osgi-version-range}'>camel-cxf</feature>
+ <bundle
dependency="true">mvn:org.eclipse.jetty.ee10/jetty-ee10-servlet/${jetty-version}</bundle>
+
<bundle>mvn:org.apache.camel.karaf/camel-cxf-transport-jetty/${project.version}</bundle>
+ </feature>
<feature name='camel-cxf-spring' version='${project.version}'
start-level='50'>
<feature version='${camel-osgi-version-range}'>camel-cxf</feature>
<feature version='${camel-osgi-version-range}'>camel-spring</feature>
diff --git a/pom.xml b/pom.xml
index 8c7d706e7..837755464 100644
--- a/pom.xml
+++ b/pom.xml
@@ -207,7 +207,6 @@
<jakarta-json-api-version>2.1.3</jakarta-json-api-version>
<jakarta-json-bind-api-version>3.0.1</jakarta-json-bind-api-version>
<jakarta-transaction-api-version>2.0.1</jakarta-transaction-api-version>
- <jakarta-jws-api-version>3.0.0</jakarta-jws-api-version>
<jaxb-core-version>4.0.5</jaxb-core-version>
<jaxb-impl-version>4.0.5</jaxb-impl-version>
<jaxb-osgi-version>4.0.5</jaxb-osgi-version>
@@ -529,7 +528,6 @@
<camel-osgi-jakarta-activation-version>[2.1,3)</camel-osgi-jakarta-activation-version>
<camel-osgi-jakarta-activation-runtime-version>[2,3)</camel-osgi-jakarta-activation-runtime-version>
<camel-osgi-jakarta-bind-version>[4,5)</camel-osgi-jakarta-bind-version>
- <camel-osgi-jakarta-jws-version>[3,4)</camel-osgi-jakarta-jws-version>
<camel-osgi-jakarta-servlet-version>[5,7)</camel-osgi-jakarta-servlet-version>
<camel-osgi-jakarta-soap-version>[3,4)</camel-osgi-jakarta-soap-version>
<camel-osgi-jakarta-validation-version>[2,4)</camel-osgi-jakarta-validation-version>
diff --git a/components/camel-cxf/pom.xml
b/tests/features/camel-cxf-jetty/pom.xml
similarity index 65%
copy from components/camel-cxf/pom.xml
copy to tests/features/camel-cxf-jetty/pom.xml
index 9da8cbf6b..ceed4fe09 100644
--- a/components/camel-cxf/pom.xml
+++ b/tests/features/camel-cxf-jetty/pom.xml
@@ -17,27 +17,15 @@
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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.apache.camel.karaf</groupId>
- <artifactId>camel-karaf-components</artifactId>
+ <artifactId>camel-karaf-features-test</artifactId>
<version>4.10.6-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>camel-cxf-parent</artifactId>
- <packaging>pom</packaging>
- <name>Apache Camel :: Karaf :: Components :: CXF :: Parent</name>
- <description>Camel CXF parent</description>
-
- <modules>
- <module>camel-cxf-all</module>
- <module>camel-cxf-spring-all</module>
- <module>camel-cxf-blueprint</module>
- <module>camel-cxf-transport-blueprint</module>
- </modules>
+ <artifactId>camel-cxf-jetty-test</artifactId>
+ <name>Apache Camel :: Karaf :: Tests :: Features :: CXF Jetty</name>
</project>
\ No newline at end of file
diff --git
a/tests/features/camel-cxf-jetty/src/main/java/org/apache/karaf/camel/test/jaxws/HelloService.java
b/tests/features/camel-cxf-jetty/src/main/java/org/apache/karaf/camel/test/jaxws/HelloService.java
new file mode 100644
index 000000000..5f2580823
--- /dev/null
+++
b/tests/features/camel-cxf-jetty/src/main/java/org/apache/karaf/camel/test/jaxws/HelloService.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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.karaf.camel.test.jaxws;
+
+import java.util.List;
+
+public interface HelloService {
+
+ String sayHello();
+
+ void ping();
+
+ int getInvocationCount();
+
+ String echo(String text) throws Exception;
+
+ Boolean echoBoolean(Boolean bool);
+
+ String complexParameters(List<String> par1, List<String> par2);
+
+}
\ No newline at end of file
diff --git
a/tests/features/camel-cxf-jetty/src/main/resources/OSGI-INF/blueprint/route.xml
b/tests/features/camel-cxf-jetty/src/main/resources/OSGI-INF/blueprint/route.xml
new file mode 100644
index 000000000..6202b83d9
--- /dev/null
+++
b/tests/features/camel-cxf-jetty/src/main/resources/OSGI-INF/blueprint/route.xml
@@ -0,0 +1,41 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="https://camel.apache.org/schema/blueprint/cxf"
+
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+
https://camel.apache.org/schema/blueprint/cxf
https://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd">
+
+ <!-- Allow the use of system properties -->
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
+ <cxf:cxfEndpoint
address="http://localhost:$[cxf.jetty.blueprint.port]/cxfjetty"
id="cxfJettyEndpoint"
+ loggingFeatureEnabled="true" loggingSizeLimit="2000"
+
serviceClass="org.apache.karaf.camel.test.jaxws.HelloService">
+ </cxf:cxfEndpoint>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route id="cxf-jetty-route">
+ <from uri="cxf:bean:cxfJettyEndpoint"/>
+ <setBody>
+ <simple>${header.operationName} ${body}</simple>
+ </setBody>
+ </route>
+ </camelContext>
+</blueprint>
\ No newline at end of file
diff --git
a/tests/features/camel-cxf-jetty/src/test/java/org/apache/karaf/camel/itest/CamelCxfJettyITest.java
b/tests/features/camel-cxf-jetty/src/test/java/org/apache/karaf/camel/itest/CamelCxfJettyITest.java
new file mode 100644
index 000000000..237cb2606
--- /dev/null
+++
b/tests/features/camel-cxf-jetty/src/test/java/org/apache/karaf/camel/itest/CamelCxfJettyITest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed 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.karaf.camel.itest;
+
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureRouteITest;
+import org.apache.karaf.camel.itests.AvailablePortProvider;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@CamelKarafTestHint(isBlueprintTest = true, externalResourceProvider =
CamelCxfJettyITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelCxfJettyITest extends AbstractCamelSingleFeatureRouteITest {
+
+ private static final String ECHO_REQUEST = "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soap:Body><ns1:echo
xmlns:ns1=\"http://jaxws.test.camel.karaf.apache.org/\">" +
+ "<arg0 xmlns=\"http://jaxws.test.camel.karaf.apache.org/\">Hello
World!</arg0></ns1:echo>" +
+ "</soap:Body></soap:Envelope>";
+
+ private final HttpClient client = HttpClient.newHttpClient();
+
+ @Test
+ public void testCxfJetty() throws Exception {
+ testEchoOperation();
+ }
+
+ private String getCxfJettyEndpointAddress() {
+ return "http://localhost:" +
ExternalResourceProviders.getCxfJettyBlueprintPort() + "/cxfjetty";
+ }
+
+ private void testEchoOperation() throws Exception {
+ URI uri = URI.create(getCxfJettyEndpointAddress());
+ HttpRequest request =
HttpRequest.newBuilder().uri(uri).header("Content-Type", "text/xml;
charset=UTF-8").header("Accept",
"text/xml").POST(HttpRequest.BodyPublishers.ofString(ECHO_REQUEST)).build();
+ HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
+ assertEquals(200, response.statusCode());
+ String body = response.body();
+ assertTrue("The response content is incorrect.", body.contains("echo
Hello World!"));
+ }
+
+ public static final class ExternalResourceProviders {
+ public static final String CXF_JETTY_BLUEPRINT_PORT =
"cxf.jetty.blueprint.port";
+
+ public static AvailablePortProvider createAvailablePortProvider() {
+ return new
AvailablePortProvider(List.of(CXF_JETTY_BLUEPRINT_PORT));
+ }
+
+ static String getCxfJettyBlueprintPort() {
+ return System.getProperty(CXF_JETTY_BLUEPRINT_PORT);
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/features/pom.xml b/tests/features/pom.xml
index 271e89485..119c2ec66 100644
--- a/tests/features/pom.xml
+++ b/tests/features/pom.xml
@@ -73,6 +73,7 @@
<module>camel-crypto</module>
<module>camel-csv</module>
<module>camel-cxf</module>
+ <module>camel-cxf-jetty</module>
<module>camel-debezium-mongodb</module>
<module>camel-debezium-mysql</module>
<module>camel-debezium-postgres</module>