Java Code Examples for org.eclipse.jetty.server.nio.NetworkTrafficSelectChannelConnector

Following code examples demonstrate how to use org.eclipse.jetty.server.nio.NetworkTrafficSelectChannelConnector from jetty. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.eclipse.jetty.server.nio.NetworkTrafficSelectChannelConnector and various code implementation of this class.
Example 1
Project : jetty Source File : CatalogProxyTest.java View Source Code on GitHub

    public static void main(String[] args) throws Exception {
        Server server = new Server();
        SslContextFactory sslContextFactory = new SslContextFactory(
                KEYSTORE_LOCATION);
        sslContextFactory.setKeyStorePassword(KEYSTORE_PASS);
        sslContextFactory.setTrustStorePath(TRUSTSTORE_LOCATION);
        sslContextFactory.setTrustStorePassword(TRUSTSTORE_PASS);
        sslContextFactory.setNeedClientAuth(true);
        NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(
                server, sslContextFactory);
        connector.setPort(8443);
        server.setConnectors(new Connector[] { connector });
        ServletContextHandler scHandler = new ServletContextHandler(server, "/");
        scHandler.addServlet(CatalogServlet.class, "/");
        server.start();
        server.join();
    }
			
Example 2
Project : jetty Source File : StaticServer.java View Source Code on GitHub

	public static void main(String[] args) throws Exception{
		Server server = new Server();
		
		NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(server);
		connector.setPort(9000);
		
		server.addConnector(connector);
		
		ResourceHandler handler = new ResourceHandler();
		handler.setDirectoriesListed(true);
		handler.setWelcomeFiles(new String[]{"index.html"});

		handler.setResourceBase("/Users/chengda/Sites");
		handler.setEtags(true);
		server.setHandler(handler);
		
		server.start();
		server.join();
		
	}
			
Example 3
Project : jetty Source File : CalcServer.java View Source Code on GitHub

    public static void main(String[] args) {
        try {
            int port = 7001;

            Server server = new Server();
            NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(server);
            connector.setPort(port);
            server.addConnector(connector);

            server.setHandler(webApp);
            server.start();
        } catch (Exception ex) {
            Logger.getLogger(CalcServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
			
Example 4
Project : jetty Source File : ServletServer.java View Source Code on GitHub

	public static void main(String[] args) throws Exception{
		Server server = new Server();
		
		NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(server);
		connector.setPort(9000);
		
		server.addConnector(connector);
		
		ServletContextHandler context = new ServletContextHandler();
		context.setContextPath("/");
		
		server.setHandler(context);
		context.addServlet(HelloServlet.class, "/hello");
		
		context.addServlet(new ServletHolder(HiSevlet.class), "/hi");
		
		server.start();
		server.join();
	}
			
Example 5
Project : jetty Source File : JCommServer.java View Source Code on GitHub

    private static void initServer() {
        try {
            server = new Server();
            NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(server);
            connector.setPort(port);
            server.addConnector(connector);

            ServletContextHandler webApp = new ServletContextHandler(server, "");
            server.setHandler(webApp);
            initServices(webApp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
			
Example 6
Project : jetty Source File : webServer.java View Source Code on GitHub

	public static void main(String[] args) throws Exception{
		Server server = new Server();
		
		NetworkTrafficSelectChannelConnector connector = new NetworkTrafficSelectChannelConnector(server);
		connector.setPort(9000);
		server.addConnector(connector);

		WebAppContext webapp = new WebAppContext();
		webapp.setContextPath("/test");
		webapp.setWar("/Users/chengda/jetty-learn/jetty/src/main/resources/test.war");
		
		server.setHandler(webapp);
		server.start();
		server.join();
	}