@Activate protected void activate() throws NamespaceException { httpService.registerResources(HALBROWSER_URI_PREFIX, "/halbrowser-webapp", null); httpService.registerResources(HALBROWSER_URI_PREFIX_LEGACY, "/halbrowser-legacy-redirect", null); }
public Object addingService(ServiceReference reference) { HttpService httpService = (HttpService) context.getService(reference); try { httpService.registerResources("/js", "/src-web", null); } catch (NamespaceException e) { e.printStackTrace(); } return null; }
@Activate void activate() throws NamespaceException { synchronized (resourceToRegistration) { for (Delegate registration : resourceToRegistration.values()) { registration.init(httpService); httpService.registerResources(registration.alias, registration.path, registration); } } }
protected void activate(BundleContext bundleContext) { try { Bundle paperuiBundle = bundleContext.getBundle(); httpService.registerResources(WEBAPP_ALIAS, "web", httpContextFactoryService.createDefaultHttpContext(paperuiBundle)); logger.info("Started Paper UI at " + WEBAPP_ALIAS); } catch (NamespaceException e) { logger.error("Error during servlet startup", e); } }
@Activate protected void activate(Map<String, Object> configProps, BundleContext bundleContext) throws NamespaceException { httpService.registerResources(WEBAPP_ALIAS, WEBAPP_NAME, new MagicHttpContext(bundleContext.getBundle())); }
public void initialize() { Preconditions.checkNotNull(httpService, "Module can not start without http service"); Preconditions.checkNotNull(url, "module url is missing. Module can not be instantiated"); Preconditions.checkNotNull(directory, "resource directory is missing. Module can not be instantiated"); logger.info("Registering resources for url {}", url); try { httpService.registerResources(url, directory, null); } catch (NamespaceException e) { logger.error("Exception occurred while registering resources with http service.", e); } if(loader != null) { Preconditions.checkNotNull(moduleName, "module name is missing. Module can not be registered with dlux"); Preconditions.checkNotNull(requireJs, "requireJs module name is missing. Module can not be registered with dlux"); Preconditions.checkNotNull(angularJs, "angularJs module name is missing. Module can not be registered with dlux"); logger.info("Registering angularJS and requireJs modules for {}", moduleName); loader.addModule(this); } }
@Activate protected void activate() throws NamespaceException, ServletException { // Mount some static resources from classpath of this bundle. httpService.registerResources(HYSTRIX_DASHBOARD_URI, "/hystrix-dashboard", null); // Mount hystrix metrix stream servlet to be used by hystrix dashboard. httpService.registerServlet(HYSTRIX_METRICS_STREAM_URI, new HystrixMetricsStreamServlet(), null, null); }
protected void activate(Map<String, Object> configProps, BundleContext bundleContext) { config.applyConfig(configProps); try { Hashtable<String, String> props = new Hashtable<String, String>(); httpService.registerServlet(WEBAPP_ALIAS + "/" + SERVLET_NAME, this, props, createHttpContext(bundleContext.getBundle())); httpService.registerResources(WEBAPP_ALIAS, "web", createHttpContext(bundleContext.getBundle())); logger.info("Started Basic UI at " + WEBAPP_ALIAS + "/" + SERVLET_NAME); } catch (NamespaceException e) { logger.error("Error during servlet startup", e); } catch (ServletException e) { logger.error("Error during servlet startup", e); } }
public void start(BundleContext bundleContext) throws Exception { ServiceReference reference = bundleContext.getServiceReference(HttpService.class.getName()); if (reference != null) { final HttpService httpService = (HttpService) bundleContext.getService(reference); try { HttpContext commonContext = new DefaultComponentEntryHttpContext(bundleContext.getBundle(), INTERNAL_CONTEXT); //register our .jsp files at the httpService Servlet servlet = new ContextPathServletAdaptor( new JspServlet(bundleContext.getBundle(), "/web"), CONTEXT); httpService.registerResources(CONTEXT, "/", commonContext); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { throw new Exception("HttpService is not found."); } }
private void doServletRegistration() { ServiceReference sr = context.getServiceReference(HttpService.class.getName()); if (sr != null) { httpServ = (HttpService) context.getService(sr); try { Servlet presentationServlet = new PresentationServlet(light .getModel()); httpServ.registerServlet("/upnp/binaryLight", presentationServlet, null, null); } catch (Exception e) { System.err.println("Exception registering presentationServlet:" + e); } try { httpServ.registerResources("/upnp/binaryLight/images", "/org/apache/felix/upnp/sample/binaryLight/images", null); } catch (Exception e) { System.err.println("Exception registering /resource:" + e); } } }
public void start(BundleContext bundleContext) throws Exception { ServiceReference reference = bundleContext.getServiceReference(HttpService.class.getName()); if (reference != null) { final HttpService httpService = (HttpService) bundleContext.getService(reference); try { HttpContext commonContext = new DefaultComponentEntryHttpContext(bundleContext.getBundle(), INTERNAL_CONTEXT); //register our .jsp files at the httpService Servlet servlet = new ContextPathServletAdaptor( new JspServlet(bundleContext.getBundle(), "/web"), CONTEXT); httpService.registerResources(CONTEXT, "/", commonContext); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { throw new Exception("HttpService is not found."); } }
public void start(BundleContext bundleContext) throws Exception { ServiceReference reference = bundleContext.getServiceReference(HttpService.class.getName()); if (reference != null) { final HttpService httpService = (HttpService) bundleContext.getService(reference); try { HttpContext commonContext = new DefaultComponentEntryHttpContext(bundleContext.getBundle(), INTERNAL_CONTEXT); //register our .jsp files at the httpService Servlet servlet = new ContextPathServletAdaptor( new JspServlet(bundleContext.getBundle(), "/web"), CONTEXT); httpService.registerResources(CONTEXT, "/", commonContext); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { throw new Exception("HttpService is not found."); } }
/** * This method is called by the application or a osgi bundle. The registration is delegated to the http service with * a OgemaHttpContext each App/Bundle. Bundle reference and the alias are registered by WebResourceManager so these * information can be provided to security handling in OgemaHttpContext. */ @Override public String registerWebResource(String alias, String name) { String result = alias; // In this case we use the HttpContext already created for this bundle. // Otherwise we need a new one. OgemaHttpContext httpCon = getOrCreateHttpContext(); alias = normalizePath(alias); name = normalizePath(name); try { // 1. register Resource to the http service fac.http.registerResources(alias, name, httpCon); } catch (NamespaceException e) { throw new RuntimeException("Webresource path already in use: " + alias); } httpCon.resources.put(result, name); return result; }
@Override public Object addingService(ServiceReference reference) { HttpService httpService = (HttpService) context.getService(reference); try { httpService.registerResources("/VAADIN", "/VAADIN", new TargetBundleHttpContext(context, "com.vaadin")); } catch (NamespaceException e) { e.printStackTrace(); } ApplicationFactoryTracker bridge = new ApplicationFactoryTracker(httpService, context); bridge.open(); return bridge; } @Override
@Validate public void start() throws ServletException, NamespaceException { CamelHttpTransportServlet srvlet = new CamelHttpTransportServlet(); httpSevlet.registerServlet("/sally", srvlet, null, null); httpSevlet.registerResources("/sally/jobad", "/app/jobad", null); httpSevlet.registerResources("/sally/client", "/app/client", null); ServletComponent servletComponent = new ServletComponent(); servletComponent.setServletName(srvlet.getServletName()); camelContextProvider.registerGlobalComponent("sallyservlet", servletComponent); }
@Activate protected void activate(ComponentContext componentContext, Map<String, Object> properties) { try { bundleContext = componentContext.getBundleContext(); Hashtable<String, String> props = new Hashtable<>(); httpService.registerServlet(DASHBOARD_ALIAS + "/" + SERVLET_NAME, createServlet(), props, httpService.createDefaultHttpContext()); httpService.registerResources(DASHBOARD_ALIAS, "web", null); if (HttpServiceUtil.getHttpServicePort(bundleContext) > 0) { logger.info("Started Dashboard at http://{}:{}", networkAddressService.getPrimaryIpv4HostAddress(), HttpServiceUtil.getHttpServicePort(bundleContext)); } if (HttpServiceUtil.getHttpServicePortSecure(bundleContext) > 0) { logger.info("Started Dashboard at https://{}:{}", networkAddressService.getPrimaryIpv4HostAddress(), HttpServiceUtil.getHttpServicePortSecure(bundleContext)); } } catch (NamespaceException | ServletException e) { logger.error("Error during Dashboard startup: {}", e.getMessage()); } addTilesForExternalServices(properties); }
@Validate public void start() throws ServletException, NamespaceException { CamelHttpTransportServlet srvlet = new CamelHttpTransportServlet(); httpSevlet.registerServlet("/sally", srvlet, null, null); httpSevlet.registerResources("/sally/static", "/static", null); servletComponent = new ServletComponent(); servletComponent.setServletName(srvlet.getServletName()); log.info("SallyURL "+SallyURL+ " "); }
public ApplicationWebAccessFactory(PermissionManager pm, HttpService http, UserAdmin userAdmin, AtomicReference<HttpConfigManagement> headerManagement, Map<String, Object> config) { this.http = http; this.pm = pm; this.headerManagement = headerManagement; this.restContext = new RestHttpContext(); //new RestAccess(permMan, admin); this.m2mLogin = new M2MLogin(pm, userAdmin); this.loginServlet = new LoginServlet(pm, userAdmin, config); try { this.http.registerResources("/login", "/web", null); this.http.registerServlet(LoginServlet.LOGIN_SERVLET_PATH, loginServlet, null, null); this.http.registerServlet("/m2mLogin", this.m2mLogin, null, restContext); } catch (NamespaceException | ServletException e) { logger.error("registration failed", e); } /** * DOS Filter for default context */ try { registerFilter(null); } catch (ServletException e) { logger.error("filter registration failed", e); } }
public HttpService addingService(ServiceReference<HttpService> reference) { final HttpService httpService = (HttpService) bundleContext .getService(reference); if (httpService != null) { // create a default context to share between registrations final HttpContext httpContext = httpService.createDefaultHttpContext(); final Dictionary<String, Object> initParams = new Hashtable<String, Object>(); try { httpService.registerServlet("/hello", new HelloServlet(), initParams, httpContext); httpService.registerServlet("/hello/logo", new HelloImage(), initParams, httpContext); httpService.registerResources("/images", "/images", httpContext); } catch (ServletException e) { e.printStackTrace(); } catch (NamespaceException e) { e.printStackTrace(); } } return httpService; }
/** * Creates a default context that will be used for all following * registrations and registers a resource for root of war. * * @throws NullArgumentException if web app is null * @see WebAppVisitor#visit(WebApp) */ public void visit(final WebApp webApp) { NullArgumentException.validateNotNull(webApp, "Web app"); bundleClassLoader = new BundleClassLoader(webApp.getBundle()); httpContext = new WebAppHttpContext( httpService.createDefaultHttpContext(), webApp.getRootPath(), webApp.getBundle(), webApp.getMimeMappings()); try { LOG.info("Pax Web not available. Skipping context params registration"); httpService.registerResources("/", "default", httpContext); //CHECKSTYLE:OFF } catch (Throwable ignore) { LOG.error("Registration exception. Skipping.", ignore); } //CHECKSTYLE:ON }