diff --git a/kura/distrib/src/main/ant/build_equinox_distrib.xml b/kura/distrib/src/main/ant/build_equinox_distrib.xml index 332175eb04..7fa07c2094 100644 --- a/kura/distrib/src/main/ant/build_equinox_distrib.xml +++ b/kura/distrib/src/main/ant/build_equinox_distrib.xml @@ -758,14 +758,34 @@ fi]]> - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -827,11 +847,6 @@ fi]]> - - - - - @@ -977,21 +992,6 @@ fi]]> - - - - - - - - - - - - - - - diff --git a/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF index 7c99ff761f..a8a76a7936 100644 --- a/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF @@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.kura.http.server.manager Bundle-Version: 2.0.0.qualifier Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml -Import-Package: org.eclipse.equinox.http.jetty;version="1.5.0", +Import-Package: org.apache.felix.http.jetty;version="4.0.0", + org.eclipse.jetty.server;version="12.0.0", org.eclipse.kura;version="[1.5,2.0)", org.eclipse.kura.configuration;version="1.2.0", org.eclipse.kura.crypto;version="[1.2,2.0)", diff --git a/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpConnectorFactory.java b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpConnectorFactory.java new file mode 100644 index 0000000000..671e671993 --- /dev/null +++ b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpConnectorFactory.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.http.server.manager; + +import java.util.EnumSet; + +import org.apache.felix.http.jetty.ConnectorFactory; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; + +public class HttpConnectorFactory implements ConnectorFactory { + + private final int port; + + public HttpConnectorFactory(int port) { + this.port = port; + } + + @Override + public Connector createConnector(Server server) { + HttpConnectionFactory connFactory = new HttpConnectionFactory(); + configureHttpConnectionFactory(connFactory); + + ServerConnector connector = new ServerConnector(server, config.getAcceptors(), config.getSelectors(), + connFactory); + + HttpConfiguration httpConfiguration = new HttpConfiguration(); + httpConfiguration.addCustomizer(new BlockHttpMethods(EnumSet.of(HttpMethod.TRACE))); + + for (final int port : ports) { + final ServerConnector newConnector = new ServerConnector(serverConnector.getServer(), + new HttpConnectionFactory(httpConfiguration)); + + customizeConnector(newConnector, port); + serverConnector.getServer().addConnector(newConnector); + } + } + +} diff --git a/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java index 28d8d45305..0856faf67d 100755 --- a/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java +++ b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2021 Eurotech and/or its affiliates and others + * Copyright (c) 2019, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -25,8 +25,6 @@ import javax.net.ssl.KeyManager; -import org.eclipse.equinox.http.jetty.JettyConfigurator; -import org.eclipse.equinox.http.jetty.JettyConstants; import org.eclipse.kura.KuraException; import org.eclipse.kura.configuration.ConfigurableComponent; import org.eclipse.kura.configuration.ConfigurationService; diff --git a/target-platform/config/kura.target-platform.build.properties b/target-platform/config/kura.target-platform.build.properties index dab11b567c..4b66ebab76 100644 --- a/target-platform/config/kura.target-platform.build.properties +++ b/target-platform/config/kura.target-platform.build.properties @@ -90,8 +90,13 @@ quartz.version=2.3.2 org.apache.felix.dependencymanager.version=3.0.0 org.apache.felix.deploymentadmin.version=0.9.5 org.apache.felix.gogo.command.version=1.1.2 -org.apache.felix.http.jetty.version=5.1.26 + org.apache.felix.http.servlet-api.version=3.0.0 +org.apache.felix.http.jetty12.version=1.0.2 +org.apache.felix.http.bridge.version=5.1.6 +org.apache.felix.http.proxy.version=4.0.0 +org.apache.felix.http.wrappers.version=1.1.2 +org.apache.felix.http.sslfilter.version=2.0.2 org.apache.felix.gogo.runtime.version=1.1.6 org.apache.felix.gogo.shell.version=1.1.4 org.apache.felix.scr.version=2.2.12 @@ -106,9 +111,6 @@ org.eclipse.equinox.common.version=3.19.100.v20240524-2011 org.eclipse.equinox.console.version=1.4.800.v20240513-1104 org.eclipse.equinox.ds.version=1.6.200.v20200422-1833 org.eclipse.equinox.event.version=1.7.100.v20240321-1445 -org.eclipse.equinox.http.jetty.version=3.9.200.v20240321-1445 -org.eclipse.equinox.http.registry.version=1.4.100.v20240321-1445 -org.eclipse.equinox.http.servlet.version=1.8.200.v20240321-1445 org.eclipse.equinox.io.version=1.1.300 org.eclipse.equinox.launcher.version=1.6.900.v20240613-2009 org.eclipse.equinox.metatype.version=1.6.600.v20240513-1104 diff --git a/target-platform/org.eclipse.kura.jetty.customizer/pom.xml b/target-platform/org.eclipse.kura.jetty.customizer/pom.xml index 5a47ecf310..8116b9e919 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/pom.xml +++ b/target-platform/org.eclipse.kura.jetty.customizer/pom.xml @@ -33,19 +33,19 @@ - org.apache.felix - org.apache.felix.http.servlet-api - 3.0.0 + org.eclipse.platform + org.eclipse.equinox.http.jetty + 3.9.200 org.apache.felix - org.apache.felix.http.jetty - 5.1.26 + org.apache.felix.http.servlet-api + 3.0.0 - org.eclipse.platform - org.eclipse.equinox.http.jetty - 3.9.200 + org.eclipse.jetty.ee8 + jetty-ee8-servlet + 12.0.14 diff --git a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java index 6d977a53ae..26cda5f938 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java +++ b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java @@ -15,16 +15,16 @@ import java.io.IOException; import java.io.Writer; -import org.eclipse.jetty.server.handler.ErrorHandler; +import javax.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletRequest; +import org.eclipse.jetty.ee8.nested.ErrorHandler; public class KuraErrorHandler extends ErrorHandler { @Override protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException { - // Not needed + // do nothing } } diff --git a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java index 1be033a230..e1808bd1cf 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java +++ b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java @@ -35,6 +35,7 @@ import org.eclipse.equinox.http.jetty.JettyConstants; import org.eclipse.equinox.http.jetty.JettyCustomizer; +import org.eclipse.jetty.ee8.servlet.ServletContextHandler; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.ConnectionFactory; @@ -49,13 +50,10 @@ import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.gzip.GzipHandler; -import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.util.compression.CompressionPool; import org.eclipse.jetty.util.compression.DeflaterPool; import org.eclipse.jetty.util.ssl.SslContextFactory; -import jakarta.servlet.SessionCookieConfig; - public class KuraJettyCustomizer extends JettyCustomizer { private DeflaterPool deflaterPool = new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.BEST_COMPRESSION, diff --git a/target-platform/p2-repo-common/pom.xml b/target-platform/p2-repo-common/pom.xml index da4087f5ae..1bd9506bce 100644 --- a/target-platform/p2-repo-common/pom.xml +++ b/target-platform/p2-repo-common/pom.xml @@ -518,11 +518,6 @@ org.apache.activemq.artemis ${org.apache.activemq.artemis.version} - - org.eclipse.kura - org.eclipse.kura.jetty.customizer - ${org.eclipse.kura.jetty.customizer.version} - jakarta.xml.bind jakarta.xml.bind-api @@ -648,7 +643,6 @@ - diff --git a/target-platform/p2-repo-equinox/pom.xml b/target-platform/p2-repo-equinox/pom.xml index e6788fb517..fa54b4faa2 100644 --- a/target-platform/p2-repo-equinox/pom.xml +++ b/target-platform/p2-repo-equinox/pom.xml @@ -56,16 +56,38 @@ org.apache.felix org.apache.felix.deploymentadmin ${org.apache.felix.deploymentadmin.version} + > + + org.apache.felix + org.apache.felix.http.servlet-api + ${org.apache.felix.http.servlet-api.version} + org.apache.felix - org.apache.felix.http.jetty - ${org.apache.felix.http.jetty.version} + org.apache.felix.http.jetty12 + light + ${org.apache.felix.http.jetty12.version} org.apache.felix - org.apache.felix.http.servlet-api - ${org.apache.felix.http.servlet-api.version} + org.apache.felix.http.bridge + ${org.apache.felix.http.bridge.version} + + + org.apache.felix + org.apache.felix.http.proxy + ${org.apache.felix.http.proxy.version} + + + org.apache.felix + org.apache.felix.http.wrappers + ${org.apache.felix.http.wrappers.version} + + + org.apache.felix + org.apache.felix.http.sslfilter + ${org.apache.felix.http.sslfilter.version} org.knowhowlab.osgi @@ -269,7 +291,7 @@ - + > @@ -366,10 +388,18 @@ - + + + + + diff --git a/target-platform/pom.xml b/target-platform/pom.xml index ca95dc0ed5..bc60d6c4da 100644 --- a/target-platform/pom.xml +++ b/target-platform/pom.xml @@ -59,7 +59,6 @@ com.gwt.user moquette-broker log4j2-api-config - org.eclipse.kura.jetty.customizer p2-repo-common p2-repo-equinox p2-repo-test-deps