Examples of registerServlet()


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

    final HttpService http = (HttpService) bc.getService(sr);

    try {
      http.registerResources(ALIAS_ROOT, RES_ROOT, new CompletingHttpContext());
      http.registerServlet(ALIAS_SERVLET, new InfoServlet(sr),
                           new Hashtable(), null);
      http.registerResources(ALIAS_DOCS, "", new DirectoryHttpContext());
    } catch (Exception e) {
      log.error("Failed to register in HttpService: " +e.getMessage(), e);
    }
View Full Code Here

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

      return;
    }
   
    try {
      Hashtable props = new Hashtable();
      http.registerServlet(Activator.SERVLET_ALIAS, servlet, props, null);
      http.registerResources(Activator.RES_ALIAS, Activator.RES_DIR, context);
    } catch (Exception e) {
      Activator.log.error("Failed to register resource", e);
    }
  }
View Full Code Here

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

                public Object addingService(ServiceReference serviceReference) {
                    try {
                        HttpService service = (HttpService)_context.getService(serviceReference);
                        Dictionary<String, String> initParams = new Hashtable<String, String>();
                        initParams.put("javax.ws.rs.Application", SampleApplication.class.getName());
                        service.registerServlet(_path, new SampleServlet(), initParams, null);
                        return service;
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        throw new RuntimeException(ex);
                    }
View Full Code Here

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

    public void testCorrectParameterCount() 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", "GET" );

        int parameterCount = 16;
        for ( int i = 0; i < parameterCount; ++i )
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()

     */
    public void testCanRegisterServlet() throws ServletException, NamespaceException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );

        httpService.registerServlet( "/", new BasicTestingServlet(), null, null );
    }


    /**
     * Test that HTTP Service does not allow same alias to be registered twice.
View Full Code Here

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

    {

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

        boolean namespaceExceptionThrown = false;
        httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );

        try
        {
            httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );
        }
View Full Code Here

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

        boolean namespaceExceptionThrown = false;
        httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );

        try
        {
            httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );
        }
        catch ( NamespaceException e )
        {
            namespaceExceptionThrown = true;
        }
View Full Code Here

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

        for ( int i = 0; i < badAliases.length; ++i )
        {
            boolean namespaceExceptionThrown = false;
            try
            {
                httpService.registerServlet( badAliases[i], new BasicTestingServlet(), null, null );
            }
            catch ( NamespaceException e )
            {
                namespaceExceptionThrown = true;
            }
View Full Code Here

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

     */
    public void testNoCookiesSentByDefault() throws ServletException, NamespaceException, IOException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );
        CookieServlet servlet = new CookieServlet( MODE_NONE_SET );
        httpService.registerServlet( "/test", servlet, null, null );

        //Test that no cookies are currently set.
        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        client.connect();
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.