diff --git a/changes.md b/changes.md
index 886ac59a5e..c997c83e2d 100644
--- a/changes.md
+++ b/changes.md
@@ -2,6 +2,11 @@ Changes log
===========
- 3.0 Milestone 2 (??-??-2026)
+ - Breaking changes
+ - Removed the OSGi support: the `Activator`, the `osgi.core` dependency and the bundle
+ packaging (Maven artifacts are now plain JARs, without `Bundle-*` manifest headers).
+ `XmlFactoryProvider` of the Jackson extension now relies on the plain `ServiceLoader`.
+ OSGi users should stay on 2.x.
- Bugs fixed
- Slf4j bridge reports wrong line number and caller class in log4j. Issue #233.
- When GET is an allowed method of a server resource, HEAD is now also listed (e.g. in the Allow header of a 405 response). Issue #266.
diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml
index eb4fa1a640..3955777648 100644
--- a/org.restlet.ext.crypto/pom.xml
+++ b/org.restlet.ext.crypto/pom.xml
@@ -10,7 +10,6 @@
In a non-OSGI context, the factories are retrieved with java service loader. + * Provides {@link javax.xml.stream.XMLInputFactory} and {@link javax.xml.stream.XMLOutputFactory}. + * The factories are retrieved with the Java service loader. * * @author Manuel Boillod */ public class XmlFactoryProvider { - /** - * Allow explicitly setting the Stax2InputFactory instance in OSGI context. In a no-OSGI - * context, the factory is retrieved with a java service loader. - * - *
Note: Stax2 implementation is provided by woodstox library, which is a dependency of - * Jackson. - */ - public static Stax2InputFactoryProvider inputFactoryProvider = null; - - /** - * Allow explicitly setting the Stax2OutputFactoryProvider instance in OSGI context. In a - * no-OSGI context, the factory is retrieved with a java service loader. - * - *
Note: Stax2 implementation is provided by woodstox library, which is a dependency of
- * Jackson.
- */
- public static Stax2OutputFactoryProvider outputFactoryProvider = null;
-
/**
* Returns an instance of {@link javax.xml.stream.XMLInputFactory} according to the classpath.
*/
public static XMLInputFactory newInputFactory() {
- if (inputFactoryProvider == null) {
- if (Edition.ANDROID.isCurrentEdition()) {
- inputFactoryProvider =
- (Stax2InputFactoryProvider)
- newProvider("com.ctc.wstx.osgi.InputFactoryProviderImpl");
- } else {
- return XMLInputFactory.newFactory();
- }
- }
- return inputFactoryProvider.createInputFactory();
+ return XMLInputFactory.newFactory();
}
/**
- * Returns an instance of {@link javax.xml.stream.XMLInputFactory} according to the classpath.
+ * Returns an instance of {@link javax.xml.stream.XMLOutputFactory} according to the classpath.
*/
public static XMLOutputFactory newOutputFactory() {
- if (outputFactoryProvider == null) {
- if (Edition.ANDROID.isCurrentEdition()) {
- outputFactoryProvider =
- (Stax2OutputFactoryProvider)
- newProvider("com.ctc.wstx.osgi.OutputFactoryProviderImpl");
- } else {
- return XMLOutputFactory.newFactory();
- }
- }
-
- return outputFactoryProvider.createOutputFactory();
- }
-
- /**
- * Instantiates a Woodstox provider by name. The OSGi package of Woodstox isn't exported by its
- * Java module, which would prevent a direct reference.
- */
- private static Object newProvider(String className) {
- try {
- return Class.forName(className).getDeclaredConstructor().newInstance();
- } catch (ReflectiveOperationException e) {
- throw new IllegalStateException("Unable to instantiate " + className, e);
- }
+ return XMLOutputFactory.newFactory();
}
}
diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml
index 496e261fe2..139e6363b6 100644
--- a/org.restlet.ext.json/pom.xml
+++ b/org.restlet.ext.json/pom.xml
@@ -10,7 +10,6 @@
- * The content of this file is subject to the terms of the Apache 2.0 open
- * source license available at https://www.opensource.org/licenses/apache-2.0
- *
- * Restlet is a registered trademark of QlikTech International AB.
- */
-package org.restlet.engine.internal;
-
-import java.net.URL;
-import java.util.List;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.restlet.Client;
-import org.restlet.Server;
-import org.restlet.engine.Engine;
-
-/**
- * OSGi activator. It registers the NRE into the Restlet API and also introspects the bundles to
- * find connector or authentication helpers.
- *
- * @author Jerome Louvel
- */
-public class Activator implements BundleActivator {
-
- /**
- * Registers the helpers for a given bundle.
- *
- * @param bundle The bundle to inspect.
- * @param helpers The helpers list to update.
- * @param constructorClass The class to use as a constructor parameter.
- * @param descriptorPath The descriptor file path.
- */
- private void registerHelper(
- Bundle bundle, List> helpers, Class> constructorClass, String descriptorPath) {
- // Discover server helpers
- URL configUrl = bundle.getEntry(descriptorPath);
-
- if (configUrl == null) {
- configUrl = bundle.getEntry("/src/" + descriptorPath);
- }
-
- if (configUrl != null) {
- registerHelper(bundle, helpers, constructorClass, configUrl);
- }
- }
-
- /**
- * Registers the helpers for a given bundle.
- *
- * @param bundle The bundle to inspect.
- * @param helpers The helpers list to update.
- * @param constructorClass The class to use as a constructor parameter.
- * @param descriptorUrl The descriptor URL to inspect.
- */
- private void registerHelper(
- final Bundle bundle, List> helpers, Class> constructorClass, URL descriptorUrl) {
- Engine.getInstance()
- .registerHelpers(
- new ClassLoader() {
- @Override
- public Class> loadClass(String name) throws ClassNotFoundException {
- return bundle.loadClass(name);
- }
- },
- descriptorUrl,
- helpers,
- constructorClass);
- }
-
- /**
- * Registers the helpers for a given bundle.
- *
- * @param bundle The bundle to inspect.
- */
- private void registerHelpers(Bundle bundle) {
- // Register server helpers
- registerHelper(
- bundle,
- Engine.getInstance().getRegisteredServers(),
- Server.class,
- Engine.DESCRIPTOR_SERVER_PATH);
-
- // Register client helpers
- registerHelper(
- bundle,
- Engine.getInstance().getRegisteredClients(),
- Client.class,
- Engine.DESCRIPTOR_CLIENT_PATH);
-
- // Register authentication helpers
- registerHelper(
- bundle,
- Engine.getInstance().getRegisteredAuthenticators(),
- null,
- Engine.DESCRIPTOR_AUTHENTICATOR_PATH);
-
- // Register converter helpers
- registerHelper(
- bundle,
- Engine.getInstance().getRegisteredConverters(),
- null,
- Engine.DESCRIPTOR_CONVERTER_PATH);
- }
-
- /**
- * Starts the OSGi bundle by registering the engine with the bundle of the Restlet API.
- *
- * @param context The bundle context.
- */
- public void start(BundleContext context) throws Exception {
- org.restlet.engine.Engine.register(false);
-
- // Discover helpers in installed bundles and start
- // the bundle if necessary
- for (final Bundle bundle : context.getBundles()) {
- registerHelpers(bundle);
- }
-
- // Listen to installed bundles
- context.addBundleListener(
- event -> {
- if (event.getType() == BundleEvent.INSTALLED) {
- registerHelpers(event.getBundle());
- }
- });
-
- Engine.getInstance().registerDefaultConnectors();
- Engine.getInstance().registerDefaultAuthentications();
- Engine.getInstance().registerDefaultConverters();
- }
-
- /**
- * Stops the OSGi bundle by unregistering the engine with the bundle of the Restlet API.
- *
- * @param context The bundle context.
- */
- public void stop(BundleContext context) throws Exception {
- org.restlet.engine.Engine.clear();
- }
-}
diff --git a/pom.xml b/pom.xml
index 33f932c1a7..0536113ee4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,6 @@