Package org.osgi.service.http

Examples of org.osgi.service.http.HttpService


        assertTrue(intentIn);
    }
   
    public void testServerUsingDefaultAddress() throws Exception {
        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
        HttpService httpService = EasyMock.createNiceMock(HttpService.class);
        // expect that the cxf servlet is registered
        EasyMock.replay(httpService);
       
        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
View Full Code Here


        EasyMock.expect(dswContext.getProperty("org.osgi.service.http.secure.enabled")).
            andReturn("true").anyTimes();
        EasyMock.expect(dswContext.getProperty("org.osgi.service.http.port.secure")).
            andReturn("8432").anyTimes();
       
        HttpService httpService = EasyMock.createNiceMock(HttpService.class);
        // expect that the cxf servlet is registered
        EasyMock.replay(httpService);
       
        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
View Full Code Here

    public void testCreateProxy() {
        IMocksControl c = EasyMock.createNiceControl();
        BundleContext bc1 = c.createMock(BundleContext.class);
        BundleContext bc2 = c.createMock(BundleContext.class);

        HttpService httpService = c.createMock(HttpService.class);

        ServiceReference httpSvcSR = c.createMock(ServiceReference.class);
        EasyMock.expect(bc1.getService(httpSvcSR)).andReturn(httpService).anyTimes();

        final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
View Full Code Here

            LOG.warning("Remote address is unavailable");
            return;
        }

        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

        Activator.this.services.remove(service);
        super.removedService(reference, service);
      }
    };
    this.tracker.open();
    final HttpService service = this.tracker.getService();
    registerServlet(service);
  }
View Full Code Here

        // register servlet to all HttpServices
        String endpoint = (String)ref.getProperty(HttpConstants.ENDPOINT);
        m_servlets.put(ref, endpoint);
        Servlet servlet = (Servlet)m_context.getService(ref);
        for (ServiceReference reference : m_httpServices) {
            HttpService httpService = (HttpService) m_context.getService(reference);
            try {
                if ((httpService != null) && (endpoint != null) && (servlet != null)) {
                    httpService.registerServlet(endpoint, servlet, null, null);
                }
                else {
                    m_log.log(LogService.LOG_WARNING, "Unable to register servlet with endpoint '" + endpoint + "'");
                }
            }
View Full Code Here

    }

    private void removeServlet(ServiceReference ref, String endpoint) {
        m_servlets.remove(ref);
        for (ServiceReference reference : m_httpServices) {
            HttpService httpService = (HttpService) m_context.getService(reference);
            if ((httpService != null) && (endpoint != null)) {
                try {
                    httpService.unregister(endpoint);
                }
                catch (Exception e) {
                    m_log.log(LogService.LOG_WARNING, "Servlet cannot be unregistered, maybe not registered under this endpoint", e);
                }
            }
View Full Code Here

    }

    @Override
    public synchronized void destroy(BundleContext context, DependencyManager arg1) throws Exception {
        for (ServiceReference httpRef : m_httpServices) {
            HttpService httpService = (HttpService)m_context.getService(httpRef);
            if (httpService != null) {
                unregisterEndpoints(httpService);
            }
        }
        m_httpServices.clear();
View Full Code Here

            }
        }
        initInternalPlugins();

        // might update HTTP service registration
        HttpService httpService = this.httpService;
        if (httpService != null)
        {
            // unbind old location first
            unbindHttpService(httpService);
View Full Code Here

        // register servlet to all HttpServices
        String endpoint = (String)ref.getProperty(HttpConstants.ENDPOINT);
        m_servlets.put(ref, endpoint);
        Servlet servlet = (Servlet)m_context.getService(ref);
        for (ServiceReference reference : m_httpServices) {
            HttpService httpService = (HttpService) m_context.getService(reference);
            try {
                if ((httpService != null) && (endpoint != null) && (servlet != null)) {
                    httpService.registerServlet(endpoint, servlet, null, null);
                }
                else {
                    m_log.log(LogService.LOG_WARNING, "Unable to register servlet with endpoint '" + endpoint + "'");
                }
            }
View Full Code Here

TOP

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

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.