mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
temporarily remove ui.start bundle from distro again (#424)
* temporarily remove ui.start bundle from distro again * correctly unregister services again * also unset the handlerRef field Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
38a2624df6
commit
24d32f877c
@ -19,12 +19,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.openhab.ui.dashboard.DashboardReady;
|
import org.openhab.ui.dashboard.DashboardReady;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleEvent;
|
import org.osgi.framework.BundleEvent;
|
||||||
|
import org.osgi.framework.ServiceRegistration;
|
||||||
import org.osgi.framework.SynchronousBundleListener;
|
import org.osgi.framework.SynchronousBundleListener;
|
||||||
import org.osgi.service.component.ComponentContext;
|
import org.osgi.service.component.ComponentContext;
|
||||||
import org.osgi.service.component.ComponentException;
|
import org.osgi.service.component.ComponentException;
|
||||||
@ -73,6 +75,7 @@ public class RootServlet extends DefaultServlet {
|
|||||||
|
|
||||||
private DashboardReady dashboardStarted;
|
private DashboardReady dashboardStarted;
|
||||||
private LifeCycleState lifecycleState = LifeCycleState.STARTING;
|
private LifeCycleState lifecycleState = LifeCycleState.STARTING;
|
||||||
|
private ServiceRegistration handlerRef;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||||
@ -126,11 +129,11 @@ public class RootServlet extends DefaultServlet {
|
|||||||
staticContent.setHandler(handler);
|
staticContent.setHandler(handler);
|
||||||
Dictionary props = new Hashtable();
|
Dictionary props = new Hashtable();
|
||||||
props.put("contextPath", STATIC_CONTENT_URL);
|
props.put("contextPath", STATIC_CONTENT_URL);
|
||||||
context.getBundleContext().registerService(ContextHandler.class.getName(), staticContent, props);
|
handlerRef = context.getBundleContext().registerService(Handler.class.getName(), staticContent, props);
|
||||||
|
|
||||||
// register servlet
|
// register servlet
|
||||||
try {
|
try {
|
||||||
httpService.registerServlet("/", this, new Properties(), httpService.createDefaultHttpContext());
|
httpService.registerServlet("/", this, new Properties(), null);
|
||||||
} catch (ServletException | NamespaceException e) {
|
} catch (ServletException | NamespaceException e) {
|
||||||
logger.error("Failed registering root servlet!", e);
|
logger.error("Failed registering root servlet!", e);
|
||||||
}
|
}
|
||||||
@ -168,7 +171,13 @@ public class RootServlet extends DefaultServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deactivate
|
@Deactivate
|
||||||
protected void deactivate() {
|
protected void deactivate(ComponentContext context) {
|
||||||
|
httpService.unregister("/");
|
||||||
|
if (handlerRef != null) {
|
||||||
|
handlerRef.unregister();
|
||||||
|
handlerRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
// reset, if this component is ever reused (should normally not be the case), it should be "starting" again.
|
// reset, if this component is ever reused (should normally not be the case), it should be "starting" again.
|
||||||
lifecycleState = LifeCycleState.STARTING;
|
lifecycleState = LifeCycleState.STARTING;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
<feature prerequisite="true">shell</feature>
|
<feature prerequisite="true">shell</feature>
|
||||||
<feature prerequisite="true">wrapper</feature>
|
<feature prerequisite="true">wrapper</feature>
|
||||||
<!-- This bundle needs to be started early as it registers the 404 and startup pages on Jetty -->
|
<!-- This bundle needs to be started early as it registers the 404 and startup pages on Jetty -->
|
||||||
<bundle start-level="30">mvn:org.openhab.core/org.openhab.ui.start/${project.version}</bundle>
|
<!-- It is temperarily disabled due to https://github.com/openhab/openhab-core/issues/422
|
||||||
|
<bundle start-level="30">mvn:org.openhab.core/org.openhab.ui.start/${project.version}</bundle> -->
|
||||||
<bundle start-level="90">mvn:org.openhab.core/org.openhab.core/${project.version}</bundle>
|
<bundle start-level="90">mvn:org.openhab.core/org.openhab.core/${project.version}</bundle>
|
||||||
<bundle>mvn:org.openhab.core/org.openhab.core.karaf/${project.version}</bundle>
|
<bundle>mvn:org.openhab.core/org.openhab.core.karaf/${project.version}</bundle>
|
||||||
<bundle>mvn:org.openhab.core/org.openhab.io.sound/${project.version}</bundle>
|
<bundle>mvn:org.openhab.core/org.openhab.io.sound/${project.version}</bundle>
|
||||||
|
Loading…
Reference in New Issue
Block a user