Examples of registerServlet()


Examples of org.osgi.service.http.HttpService.registerServlet()

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

            // Unregister the servlet alias
            httpService.unregister("/service");
            assertNotAvailable(reqspec, headers);
View Full Code Here

Examples of org.osgi.service.http.HttpService.registerServlet()

    public void testParameterContents() throws IOException, ServletException, NamespaceException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );

        BasicTestingServlet testServlet = new BasicTestingServlet();
        httpService.registerServlet( "/test", testServlet, null, null );

        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        int parameterCount = 16;
        for ( int i = 0; i < parameterCount; ++i )
View Full Code Here

Examples of org.osgi.service.http.HttpService.registerServlet()

        }

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

Examples of org.osgi.service.http.HttpService.registerServlet()

        }

        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

Examples of org.osgi.service.http.HttpService.registerServlet()

        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

Examples of org.osgi.service.http.HttpService.registerServlet()

        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

Examples of org.osgi.service.http.HttpService.registerServlet()

                                          commonContext);

            Servlet adaptedJspServlet = new ContextPathServletAdaptor(
                    new JspServlet(context.getBundle(), "/web"),
                    "/jsp-examples");
            httpService.registerServlet("/jsp-examples/*.jsp", adaptedJspServlet, null,
                                        commonContext);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
View Full Code Here

Examples of org.osgi.service.http.HttpService.registerServlet()

      try {     
        HttpContext commonContext = new BundleEntryHttpContext(context.getBundle(), "/web");
        httpService.registerResources("/struts-examples", "/", commonContext); //$NON-NLS-1$ //$NON-NLS-2$
       
        Servlet adaptedJspServlet = new ContextPathServletAdaptor(new JspServlet(context.getBundle(), "/web"), "/struts-examples"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        httpService.registerServlet("/struts-examples/*.jsp", adaptedJspServlet, null, commonContext); //$NON-NLS-1$
       
        Dictionary initparams = new Hashtable();
        initparams.put("servlet-name", "action"); //Note: requires servlet-name support in Http Service Implementation
        initparams.put("config", "/WEB-INF/struts-config.xml");
        initparams.put("config/exercise", "/WEB-INF/exercise/struts-config.xml");
View Full Code Here

Examples of org.osgi.service.http.HttpService.registerServlet()

        initparams.put("config/validator", "/WEB-INF/validator/struts-config.xml");
        initparams.put("config/dispatch", "/WEB-INF/dispatch/struts-config.xml");
        initparams.put("debug", "2");
        initparams.put("detail", "2");
        Servlet adaptedActionServlet = new ContextPathServletAdaptor(new ActionServlet(), "/struts-examples");
        httpService.registerServlet("/struts-examples/*.do", adaptedActionServlet, initparams, commonContext);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      return httpService;
View Full Code Here

Examples of org.osgi.service.http.HttpService.registerServlet()

                new CarbonSecuredHttpContext(context.getBundle(), "/web", uiResourceRegistry, registry);

        //Registering filedownload servlet
        Servlet fileDownloadServlet = new ContextPathServletAdaptor(new FileDownloadServlet(
                context, getConfigurationContextService()), "/filedownload");
        httpService.registerServlet("/filedownload", fileDownloadServlet, null, commonContext);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.SERVER_URL, serverURL);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.INDEX_PAGE_URL, indexPageURL);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.