Package org.osgi.service.http

Examples of org.osgi.service.http.HttpContext


        data.addUser(new User("Nicolas", "img/user5.png"));
        DEBUG("HTTP Web controler starting");
        if (webContainer != null) {
            try {
                // create a default context to share between registrations
                final HttpContext httpContext = webContainer.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary initParams = new Hashtable();
                initParams.put("from", "HttpService");
                webContainer.registerServlet("/", this, initParams, httpContext);
                //register JSP
View Full Code Here


        if (httpServiceRef != null && !registerService) {
            LOG.info("Register the servlet service");
            final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary<String, String> initParams = new Hashtable<String, String>();
                initParams.put("matchOnUriPrefix", "false");
                initParams.put("servlet-name", "CamelServlet");
                httpService.registerServlet("/camel/services", // alias
View Full Code Here

            Map<String, String> headers = Collections.singletonMap("Authorization", "Basic " + Base64Encoder.encode("graviaUser:graviaPass"));

            // Verify that the alias is not yet available
            assertNotAvailable(reqspec, headers);

            HttpContext base = httpService.createDefaultHttpContext();
            String realm = RuntimeType.getRuntimeType() == RuntimeType.KARAF ? "gravia" : "ApplicationRealm";
            HttpContext secureContext = new SecureHttpContext(base, realm, "graviaRole");

            // Register the test servlet and make a call
            httpService.registerServlet("/service", new HttpServiceServlet(module), null, secureContext);
            Assert.assertEquals("Hello: Kermit", performCall(reqspec, headers));
View Full Code Here

            Map<String, String> headers = Collections.singletonMap("Authorization", "Basic " + Base64Encoder.encode("graviaUser:graviaPass"));

            // Verify that the alias is not yet available
            assertNotAvailable(reqspec, headers);

            HttpContext base = httpService.createDefaultHttpContext();
            String realm = RuntimeType.getRuntimeType() == RuntimeType.KARAF ? "gravia" : "ApplicationRealm";
            HttpContext secureContext = new SecureHttpContext(base, realm, "graviaRole");

            // Register the test resource and make a call
            httpService.registerResources("/resource", "/res", secureContext);
            Assert.assertEquals("Hello from Resource", performCall(reqspec, headers));
View Full Code Here

    }


    protected HttpContext getHttpContext(BundleContext bundleContext, HttpService httpService) {

        HttpContext httpContext = httpService.createDefaultHttpContext();
        return new SecurityDelegatingHttpContext(bundleContext, httpContext);
    }
View Full Code Here

        }

        CXFNonSpringServlet cxf = new CXFNonSpringServlet();
        HttpService httpService = getHttpService();
        try {
            HttpContext httpContext = getHttpContext(dswContext, httpService);                                httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(),                                         httpContext);
            LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
        } catch (Exception e) {
            throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
        }
        Bus bus = cxf.getBus();
View Full Code Here

  private BundleContext m_bundleContext;
   
    public void start() {
        m_context = m_http.createDefaultHttpContext();
        try {
            m_http.registerResources("/VAADIN", "/VAADIN", new HttpContext() {
                public String getMimeType(String name) {
                    return m_context.getMimeType(name);
                }

                /**
 
View Full Code Here

            servlet = new MAPServlet();
        }

        servlet.setOperationEngine(opEngine);

        HttpContext httpContext = new HttpContext() {
            public boolean handleSecurity(HttpServletRequest request,
                                          HttpServletResponse response) {
                return true;
            }
View Full Code Here

            servlet = new ICSServlet();
        }

        servlet.setComponentContext(context);

        HttpContext httpContext = new HttpContext() {
            public boolean handleSecurity(HttpServletRequest request,
                                          HttpServletResponse response) {
                return true;
            }
View Full Code Here

                        "'" + originalPath + "' was not found");
                return;
            }

            // Perform a security check before dispatching the request.
            HttpContext httpContext = registration.getHttpContext();
            if (!httpContext.handleSecurity(request, response)) {
                return;
            }

            // It is possible that in the time between getting the registration
            // and invoking it that the bundle that registered it has been
View Full Code Here

TOP

Related Classes of org.osgi.service.http.HttpContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.