- eventAdmin.thenAccept((eventAdmin) -> {
- CmsRcpServlet servlet = new CmsRcpServlet(eventAdmin, cmsApp);
- Hashtable<String, String> serviceProperties = new Hashtable<>();
- serviceProperties.put("osgi.http.whiteboard.servlet.pattern", "/" + contextName + "/*");
- ServiceRegistration<Servlet> sr = bundleContext.registerService(Servlet.class, servlet,
- serviceProperties);
- registrations.put(contextName, sr);
+ httpServer.thenAcceptAsync((httpServer) -> {
+ httpServer.createContext("/" + contextName, new HttpHandler() {
+
+ @Override
+ public void handle(HttpExchange exchange) throws IOException {
+ String path = exchange.getRequestURI().getPath();
+ String uiName = path != null ? path.substring(path.lastIndexOf('/') + 1) : "";
+ CmsRcpDisplayFactory.openCmsApp(cmsApp, uiName, null);
+ exchange.sendResponseHeaders(200, -1);
+ logger.log(Level.DEBUG, "Opened RCP UI " + uiName + " of CMS App /" + contextName);
+ }
+ });
+ }).exceptionally(e -> {
+ logger.log(Level.ERROR, "Cannot register RCO app " + contextName, e);
+ return null;