Package org.osgi.service.http

Examples of org.osgi.service.http.HttpContext


        this.httpContext = httpContext;
    }
   
    @Override
    public void afterPropertiesSet() throws Exception {
        HttpContext actualHttpContext = (httpContext == null)
            ? httpService.createDefaultHttpContext()
            : httpContext;
        final Dictionary<String, String> initParams = new Hashtable<String, String>();
        // The servlet will always have to match on uri prefix as some endpoints may do so
        initParams.put("matchOnUriPrefix", "true");
View Full Code Here


    m_httpServiceRef = bc.getServiceReference(HttpService.class.getName());
    if (m_httpServiceRef != null) {
      final HttpService httpService = (HttpService) bc.getService(m_httpServiceRef);
      if (httpService != null) {
        // create a default context to share between registrations
        final HttpContext httpContext = httpService.createDefaultHttpContext();
        // register the hello world servlet
        final Dictionary initParams = new Hashtable();
        initParams.put("from", "HttpService");
        httpService.registerServlet(
            "/helloworld/hs",                           // alias
View Full Code Here

      if (servletConfig instanceof BundleServletConfig) {
        BundleServletConfig bundleServletConfig =
          (BundleServletConfig)servletConfig;

        HttpContext httpContext = bundleServletConfig.getHttpContext();

        if (!httpContext.handleSecurity(
            (HttpServletRequest)servletRequest,
            (HttpServletResponse)servletResponse)) {

          return;
        }
View Full Code Here

      if (action != ACTION_REMOVED) {
        String contextId = GetterUtil.getString(
          serviceReference.getProperty("contextId"));

        HttpContext httpContext = httpSupport.getHttpContext(contextId);

        if (httpContext == null) {
          httpContext = bundleServletContext.getHttpContext();
        }
View Full Code Here

    if (httpService == null) {
      return httpService;
    }

    HttpContext httpContext = httpService.createDefaultHttpContext();

    readConfiguration(_bundle);

    ExtendedHttpService extendedHttpService =
      (ExtendedHttpService)httpService;
View Full Code Here

    public void setHttpContext(HttpContext httpContext) {
        this.httpContext = httpContext;
    }
    public void register() throws Exception {
        HttpContext actualHttpContext = (httpContext == null)
            ? httpService.createDefaultHttpContext()
            : httpContext;
        final Dictionary<String, String> initParams = new Hashtable<String, String>();
        // The servlet will always have to match on uri prefix as some endpoints may do so
        initParams.put("matchOnUriPrefix", "true");
View Full Code Here

        }

        @Override
        public HttpService addingService(ServiceReference<HttpService> reference) {
            HttpService httpService = context.getService(reference);
            final HttpContext httpContext = httpService.createDefaultHttpContext();
            final Dictionary<String, String> initParams = new Hashtable<String, String>();
            initParams.put("servlet-name", "TestServlet");
            try {
                httpService.registerServlet(EchoServlet.ALIAS, new EchoServlet(), initParams, httpContext);
                LOG.info("Servlet registered successfully");
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

        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);
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.