Package com.sun.grizzly.http

Examples of com.sun.grizzly.http.SelectorThread


        initParams.put("com.sun.jersey.config.property.packages",
                       "org.apache.zookeeper.server.jersey.resources");

        System.out.println("Starting grizzly...");
        SelectorThread threadSelector =
            GrizzlyWebContainerFactory.create(baseUri, initParams);

        return threadSelector;
    }
View Full Code Here


        final String zkHostPort = args[1];

        ZooKeeperService.mapUriBase(baseUri, zkHostPort);

        RestMain main = new RestMain(baseUri);
        SelectorThread sel = main.execute();

        System.out.println(String.format(
                "Jersey app started with WADL available at %sapplication.wadl\n” +"
                + "Try out %szookeeper\nHit enter to stop it...",
                baseUri, baseUri));

        System.in.read();
        sel.stopEndpoint();

        ZooKeeperService.close(baseUri);
        System.exit(0);
    }
View Full Code Here

   * @throws IllegalArgumentException
   */
  public static void main(String[] args) throws IllegalArgumentException, IOException {
    Map<String,String> initParams = new HashMap<String, String>();
    initParams.put("com.sun.jersey.config.property.packages", "com.ipc.oce.jaxrs" );
      SelectorThread selector = GrizzlyWebContainerFactory.create( "http://localhost:9998/", initParams );
      System.in.read();
      selector.stopEndpoint();
      System.exit(0);
     
    /*InputParameters iParam = parseInput(args);
   
    String baseUri = iParam.host;
View Full Code Here

        if (adapter instanceof GrizzlyAdapter) {
            GrizzlyAdapter ga = (GrizzlyAdapter)adapter;
            ga.setResourcesContextPath(u.getRawPath());
        }
       
        final SelectorThread selectorThread = new SelectorThread();

        selectorThread.setAlgorithmClassName(StaticStreamAlgorithm.class.getName());
       
        final int port = (u.getPort() == -1) ? 80 : u.getPort();           
        selectorThread.setPort(port);

        selectorThread.setAdapter(adapter);
       
        try {
            selectorThread.listen();
        } catch (InstantiationException e) {
            IOException _e = new IOException();
            _e.initCause(e);
            throw _e;
        }
View Full Code Here

        initParams.put("com.sun.jersey.config.property.packages",
                "$package");

        System.out.println("Starting grizzly...");
        SelectorThread threadSelector = GrizzlyWebContainerFactory.create(BASE_URI, initParams);    
        return threadSelector;
    }
View Full Code Here

        SelectorThread threadSelector = GrizzlyWebContainerFactory.create(BASE_URI, initParams);    
        return threadSelector;
    }
   
    public static void main(String[] args) throws IOException {
        SelectorThread threadSelector = startServer();
        System.out.println(String.format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nHit enter to stop it...",
                BASE_URI));
        System.in.read();
        threadSelector.stopEndpoint();
    }   
View Full Code Here

        if (adapter instanceof GrizzlyAdapter) {
            GrizzlyAdapter ga = (GrizzlyAdapter)adapter;
            ga.setResourcesContextPath(u.getRawPath());
        }

        final SelectorThread selectorThread = new SelectorThread();

        selectorThread.setAlgorithmClassName(StaticStreamAlgorithm.class.getName());

        final int port = (u.getPort() == -1) ? 80 : u.getPort();
        selectorThread.setPort(port);
        selectorThread.setAddress(InetAddress.getByName(u.getHost()));

        selectorThread.setAdapter(adapter);

        try {
            selectorThread.listen();
        } catch (InstantiationException e) {
            IOException _e = new IOException();
            _e.initCause(e);
            throw _e;
        }
View Full Code Here

        final String scheme = u.getScheme();
        if (!scheme.equalsIgnoreCase("http"))
            throw new IllegalArgumentException("The URI scheme, of the URI " + u +
                    ", must be equal (ignoring case) to 'http'");           
       
        final SelectorThread selectorThread = new SelectorThread();

        selectorThread.setAlgorithmClassName(StaticStreamAlgorithm.class.getName());
       
        final int port = (u.getPort() == -1) ? 80 : u.getPort();           
        selectorThread.setPort(port);

        selectorThread.setAdapter(adapter);
       
        try {
            selectorThread.listen();
        } catch (InstantiationException e) {
            IOException _e = new IOException();
            _e.initCause(e);
            throw _e;
        }
View Full Code Here

        if (adapter instanceof GrizzlyAdapter) {
            GrizzlyAdapter ga = (GrizzlyAdapter)adapter;
            ga.setResourcesContextPath(u.getRawPath());
        }
       
        final SelectorThread selectorThread = new SelectorThread();

        selectorThread.setAlgorithmClassName(StaticStreamAlgorithm.class.getName());
       
        final int port = (u.getPort() == -1) ? 80 : u.getPort();           
        selectorThread.setPort(port);

        selectorThread.setAdapter(adapter);
       
        try {
            selectorThread.listen();
        } catch (InstantiationException e) {
            IOException _e = new IOException();
            _e.initCause(e);
            throw _e;
        }
View Full Code Here

        initParams.put("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig");
        initParams.put("com.sun.jersey.config.property.packages", "org.dbpedia.spotlight.web.rest.resources");
        initParams.put("com.sun.jersey.config.property.WadlGeneratorConfig", "org.dbpedia.spotlight.web.rest.wadl.ExternalUriWadlGeneratorConfig");


        SelectorThread threadSelector = GrizzlyWebContainerFactory.create(serverURI, initParams);
        threadSelector.start();

        System.err.println("Server started in " + System.getProperty("user.dir") + " listening on " + serverURI);

        Thread warmUp = new Thread() {
            public void run() {
                //factory.searcher().warmUp((int) (configuration.getMaxCacheSize() * 0.7));
            }
        };
        warmUp.start();


        while(running) {
            Thread.sleep(100);
        }

        //Stop the HTTP server
        //server.stop(0);
        threadSelector.stopEndpoint();
        System.exit(0);

    }
View Full Code Here

TOP

Related Classes of com.sun.grizzly.http.SelectorThread

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.