diff --git a/bundles/org.openhab.io.hueemulation/pom.xml b/bundles/org.openhab.io.hueemulation/pom.xml
index 1f50f23a6..0d1f77bda 100644
--- a/bundles/org.openhab.io.hueemulation/pom.xml
+++ b/bundles/org.openhab.io.hueemulation/pom.xml
@@ -14,10 +14,6 @@
openHAB Add-ons :: Bundles :: IO :: Hue Emulation Service
-
- org.glassfish.jersey.*;resolution:="optional"
-
-
diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/ConfigStore.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/ConfigStore.java
index a10e7f799..c084eb9d0 100644
--- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/ConfigStore.java
+++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/ConfigStore.java
@@ -71,8 +71,7 @@ import com.google.gson.GsonBuilder;
*
* @author David Graeff - Initial contribution
*/
-@Component(immediate = false, service = { ConfigStore.class }, configurationPid = {
- HueEmulationService.CONFIG_PID }, property = "com.eclipsesource.jaxrs.publish=false")
+@Component(immediate = false, service = ConfigStore.class, configurationPid = HueEmulationService.CONFIG_PID)
@ConfigurableService(category = "io", label = "Hue Emulation", description_uri = "io:hueemulation")
@NonNullByDefault
public class ConfigStore {
diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationService.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationService.java
index 368428dea..17773a252 100644
--- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationService.java
+++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationService.java
@@ -14,9 +14,8 @@ package org.openhab.io.hueemulation.internal;
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.Set;
-import javax.servlet.ServletException;
-import javax.ws.rs.ApplicationPath;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
@@ -28,10 +27,6 @@ import javax.ws.rs.core.Application;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.http.HttpHeader;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.server.ServerProperties;
-import org.glassfish.jersey.servlet.ServletContainer;
-import org.glassfish.jersey.servlet.ServletProperties;
import org.openhab.io.hueemulation.internal.rest.ConfigurationAccess;
import org.openhab.io.hueemulation.internal.rest.LightsAndGroups;
import org.openhab.io.hueemulation.internal.rest.Rules;
@@ -42,6 +37,7 @@ import org.openhab.io.hueemulation.internal.rest.StatusResource;
import org.openhab.io.hueemulation.internal.rest.UserManagement;
import org.openhab.io.hueemulation.internal.upnp.UpnpServer;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
@@ -54,8 +50,8 @@ import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
-import org.osgi.service.http.HttpService;
-import org.osgi.service.http.NamespaceException;
+import org.osgi.service.jaxrs.whiteboard.JaxrsWhiteboardConstants;
+import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,17 +71,12 @@ import org.slf4j.LoggerFactory;
* @author David Graeff - Initial Contribution
*/
@NonNullByDefault
-@Component(immediate = true, service = { HueEmulationService.class }, property = {
- "com.eclipsesource.jaxrs.publish=false" })
+@Component(immediate = true, service = HueEmulationService.class)
public class HueEmulationService implements EventHandler {
public static final String CONFIG_PID = "org.openhab.hueemulation";
public static final String RESTAPI_PATH = "/api";
-
- @ApplicationPath(RESTAPI_PATH)
- public static class JerseyApplication extends Application {
-
- }
+ public static final String REST_APP_NAME = "HueEmulation";
@PreMatching
public class RequestInterceptor implements ContainerRequestFilter {
@@ -117,6 +108,34 @@ public class HueEmulationService implements EventHandler {
}
private final ContainerRequestFilter requestCleaner = new RequestInterceptor();
+
+ /**
+ * The Jax-RS application that starts up all REST activities.
+ * It registers itself as a Jax-RS Whiteboard service and all Jax-RS resources that are targeting REST_APP_NAME will
+ * start up.
+ */
+ @JaxrsName(REST_APP_NAME)
+ private class RESTapplication extends Application {
+ private String root;
+
+ RESTapplication(String root) {
+ this.root = root;
+ }
+
+ @NonNullByDefault({})
+ @Override
+ public Set