Examples of registerServlet()


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

        httpService.unregister( "/test" );

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

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

        client.connect();
View Full Code Here

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

        HttpService httpService = getHTTPService( registry.getBundleContext() );

        byte[] content = generateRandomBinaryContent();

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

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

        client.connect();
View Full Code Here

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

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

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

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

        client.connect();
        assertTrue( client.getResponseCode() == 200 );
View Full Code Here

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

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

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

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

        client.connect();
        assertTrue( client.getResponseCode() == 200 );
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>(), null);
            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()

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

        // Register the test servlet and make a call
        String servletAlias = getRuntimeAwareAlias("/servlet");
        httpService.registerServlet(servletAlias, new HttpServiceServlet(module), null, null);
        Assert.assertEquals("http-service:1.0.0", performCall(reqspec));

        // Unregister the servlet alias
        httpService.unregister(servletAlias);
        assertNotAvailable(reqspec);
View Full Code Here

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

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

            // Register the test servlet and make a call
            String servletAlias = getRuntimeAwareAlias("/servlet");
            httpService.registerServlet(servletAlias, new HttpServiceServlet(module), null, null);
            Assert.assertEquals("http-service:1.0.0", performCall(reqspec));

            // Unregister the servlet alias
            httpService.unregister(servletAlias);
            assertNotAvailable(reqspec);
View Full Code Here

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

                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
                    new CamelHttpTransportServlet(), // register servlet
                    initParams, // init params
                    httpContext // http context
                );
                registerService = true;
View Full Code Here

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

            @Override
            public HttpService addingService(ServiceReference<HttpService> sref) {
                HttpService service = super.addingService(sref);
                try {
                    RuntimeLogger.LOGGER.info("Register system HttpService with alias: " + SYSTEM_ALIAS);
                    service.registerServlet(SYSTEM_ALIAS, new HttpServiceServlet(module), null, null);
                } catch (Exception ex) {
                    throw new IllegalStateException(ex);
                }
                return service;
            }
View Full Code Here

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

        try {
            // Verify that the alias is not yet available
            assertNotAvailable(reqspec);

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

            // Unregister the servlet alias
            httpService.unregister("/service");
            assertNotAvailable(reqspec);
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.