Examples of HttpService


Examples of org.apache.http.protocol.HttpService

                    // Set up request handlers
                    HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
                    reqistry.register("*", new HttpFileHandler(this.docRoot));
                   
                    // Set up the HTTP service
                    HttpService httpService = new HttpService(
                            httpproc,
                            new DefaultConnectionReuseStrategy(),
                            new DefaultHttpResponseFactory());
                    httpService.setParams(this.params);
                    httpService.setHandlerResolver(reqistry);
                   
                    // Start worker thread
                    Thread t = new WorkerThread(httpService, conn);
                    t.setDaemon(true);
                    t.start();
View Full Code Here

Examples of org.apache.http.protocol.HttpService

                while (!shutdown && !Thread.interrupted()) {
                    try {
                        // Set up HTTP connection
                        HttpServerConnection conn = acceptConnection();
                        // Set up the HTTP service
                        HttpService httpService = new HttpService(
                                httpproc,
                                connStrategy,
                                responseFactory);
                        httpService.setParams(params);
                        httpService.setExpectationVerifier(expectationVerifier);
                        httpService.setHandlerResolver(reqistry);
                       
                        // Start worker thread
                        Thread t = new WorkerThread(httpService, conn);
                        t.setDaemon(true);
                        t.start();
View Full Code Here

Examples of org.apache.tomcat.lite.http.HttpChannel.HttpService

        mCtx.addWrapper("/sleep/10", new SleepCallback().sleep(10000).setData(
                "sleep 1"));

        mCtx.addWrapper("/chunked/*", new StaticContentService().setData("AAAA")
                .chunked());
        mCtx.addWrapper("/helloClose", new HttpService() {
            @Override
            public void service(HttpRequest httpReq, HttpResponse httpRes)
                    throws IOException {
                httpRes.setHeader("Connection", "close");
                httpRes.getBodyWriter().write("Hello");
View Full Code Here

Examples of org.osgi.service.http.HttpService

        return; // already done
      }
     
      log.debug("set axis servlet for " + httpSR);
     
      HttpService http = (HttpService)Activator.bc.getService(httpSR);
     
      try {
        Axis2Servlet      axisServlet  = new Axis2Servlet();
        Axis2AdminServlet adminServlet = new Axis2AdminServlet(axisServlet);

        http.registerServlet(AXIS2_SERVLET_ALIAS, axisServlet, new Hashtable(), myHttpContext);
        http.registerServlet(AXIS2ADMIN_SERVLET_ALIAS, adminServlet, new Hashtable(), myHttpContext);
       
        log.info("registered axis servlet at " + AXIS2_SERVLET_ALIAS);
        log.info("registered axis admin servlet at " + AXIS2ADMIN_SERVLET_ALIAS);
       
        servletRegistrations.put(httpSR, new Object[] {
View Full Code Here

Examples of org.osgi.service.http.HttpService

        }
      } catch (Exception e) {
        log.warn("Failed to undeploy", e);
      }
     
      HttpService http = (HttpService)Activator.bc.getService(httpSR);
     
      if(http != null) {
        http.unregister(AXIS2_SERVLET_ALIAS);
        http.unregister(AXIS2ADMIN_SERVLET_ALIAS);
        bc.ungetService(httpSR);
      }
      servletRegistrations.remove(httpSR);
    }
  }
View Full Code Here

Examples of org.osgi.service.http.HttpService

  private HttpService register(final ServiceReference sr)
  {
    log.info("Registering with added HttpService");

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

    log.info("Registration done.");
View Full Code Here

Examples of org.osgi.service.http.HttpService

      e.printStackTrace();
    }
  }
 
  void register(ServiceReference sr) {
    HttpService http = (HttpService) bc.getService(sr);
    if (http == null) {
      Activator.log.warn("http resource is null");
      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

        PrivateAccessor.setField(servlet, "config", config);
        PrivateAccessor.setField(servlet, "clusterViewService", clusterViewService);
        PrivateAccessor.setField(servlet, "announcementRegistry", announcementRegistry);

        Mockery context = new JUnit4Mockery();
        final HttpService httpService = context.mock(HttpService.class);
        context.checking(new Expectations() {
            {
                allowing(httpService).registerServlet(with(any(String.class)),
                        with(any(Servlet.class)),
                        with(any(Dictionary.class)),
View Full Code Here

Examples of org.osgi.service.http.HttpService

            _context,
            HttpService.class.getName(),
            new ServiceTrackerCustomizer() {
                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);
                    }
                }

                public void modifiedService(ServiceReference serviceReference, Object o) {
                    // do nothing
                }

                public void removedService(ServiceReference serviceReference, Object o) {
                    HttpService service = (HttpService)_context.getService(serviceReference);
                    if (service != null) {
                        service.unregister(_path);
                    }
                }
            }
        );
        _tracker.open();
View Full Code Here

Examples of org.osgi.service.http.HttpService

     * @throws NamespaceException
     * @throws IOException
     */
    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
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.