Package org.eclipse.jetty.server.nio

Examples of org.eclipse.jetty.server.nio.SelectChannelConnector


      //Set jetty thread pool
      serverForAgent.setThreadPool(new QueuedThreadPool(25));
      server.setThreadPool(new QueuedThreadPool(25));

      /* Configure the API server to use the NIO connectors */
      SelectChannelConnector apiConnector;

      if (configs.getApiSSLAuthentication()) {
        String httpsKeystore = configsMap.get(Configuration.CLIENT_API_SSL_KSTR_DIR_NAME_KEY) +
          File.separator + configsMap.get(Configuration.CLIENT_API_SSL_KSTR_NAME_KEY);
        LOG.info("API SSL Authentication is turned on. Keystore - " + httpsKeystore);

        String httpsCrtPass = configsMap.get(Configuration.CLIENT_API_SSL_CRT_PASS_KEY);

        SslSelectChannelConnector sapiConnector = new SslSelectChannelConnector();
        sapiConnector.setPort(configs.getClientSSLApiPort());
        sapiConnector.setKeystore(httpsKeystore);
        sapiConnector.setTruststore(httpsKeystore);
        sapiConnector.setPassword(httpsCrtPass);
        sapiConnector.setKeyPassword(httpsCrtPass);
        sapiConnector.setTrustPassword(httpsCrtPass);
        sapiConnector.setKeystoreType("PKCS12");
        sapiConnector.setTruststoreType("PKCS12");
        sapiConnector.setMaxIdleTime(configs.getConnectionMaxIdleTime());
        apiConnector = sapiConnector;
      }
      else  {
        apiConnector = new SelectChannelConnector();
        apiConnector.setPort(configs.getClientApiPort());
        apiConnector.setMaxIdleTime(configs.getConnectionMaxIdleTime());
      }

      server.addConnector(apiConnector);

      server.setStopAtShutdown(true);
View Full Code Here


    public void setSslSocketConnectors(Map <Integer, SslSelectChannelConnector> connectors) {
        sslSocketConnectors = connectors;
    }

    public SelectChannelConnector getSocketConnector(int port) throws Exception {
        SelectChannelConnector answer = null;
        if (socketConnectors != null) {
            answer = socketConnectors.get(port);
        }
        if (answer == null) {
            answer = createSocketConnector();
View Full Code Here

        }
        return answer;
    }

    protected SelectChannelConnector createSocketConnector() throws Exception {
        SelectChannelConnector answer = new SelectChannelConnector();
        if (getSocketConnectorProperties() != null) {
            // must copy the map otherwise it will be deleted
            Map<String, Object> properties = new HashMap<String, Object>(getSocketConnectorProperties());
            IntrospectionSupport.setProperties(answer, properties);
            if (properties.size() > 0) {
                throw new IllegalArgumentException("There are " + properties.size()
                    + " parameters that couldn't be set on the SocketConnector."
                    + " Check the uri if the parameters are spelt correctly and that they are properties of the SelectChannelConnector."
                    + " Unknown parameters=[" + properties + "]");
            }
        }

        if (requestBufferSize != null) {
            answer.setRequestBufferSize(requestBufferSize);
        }
        if (requestHeaderSize != null) {
            answer.setRequestHeaderSize(requestHeaderSize);
        }
        if (responseBufferSize != null) {
            answer.setResponseBufferSize(responseBufferSize);
        }
        if (responseHeaderSize != null) {
            answer.setResponseBufferSize(responseHeaderSize);
        }
        return answer;
    }
View Full Code Here

        isRunning = running;
    }

    public void start()  {
        server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(port);
        server.addConnector(connector);

        ResourceHandler resource_handler = new ResourceHandler();
        resource_handler.setDirectoriesListed(true);
        resource_handler.setWelcomeFiles(new String[]{ "index.html" });
View Full Code Here

        isRunning = running;
    }

    public void start()  {
        server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(port);
        server.addConnector(connector);

        ResourceHandler resource_handler = new ResourceHandler();
        resource_handler.setDirectoriesListed(true);
        resource_handler.setWelcomeFiles(new String[]{ "index.html" });
View Full Code Here

            sslConnector.setKeystore(sslKeystorePath);
            sslConnector.setPassword(sslKeystorePassword);
            sslConnector.setKeyPassword(sslKeystorePassword);
            connector = sslConnector;
        } else {
            connector = new SelectChannelConnector();
        }
        connector.setPort(port);
        server.setConnectors(new Connector[] { connector });

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
View Full Code Here

        Server server = new Server();

        if (port != -1)
        {
            SelectChannelConnector connector = new SelectChannelConnector();
            connector.setPort(port);
            if (sslPort != -1)
            {
                connector.setConfidentialPort(sslPort);
            }
            server.addConnector(connector);
        }

        if (sslPort != -1)
        {
            IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
            String keyStorePath = getKeyStorePath(appRegistry);

            SslContextFactory factory = new SslContextFactory();
            factory.setKeyStorePath(keyStorePath);
            factory.setKeyStorePassword(appRegistry.getConfiguration().getManagementKeyStorePassword());

            SslSocketConnector connector = new SslSocketConnector(factory);
            connector.setPort(sslPort);
            server.addConnector(connector);
        }

        ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
        root.setContextPath("/");
View Full Code Here

/**
* @version $Rev: 759104 $ $Date: 2009-03-27 19:21:58 +0800 (Fri, 27 Mar 2009) $
*/
public class HTTPSelectChannelConnector extends JettyConnector {
    public HTTPSelectChannelConnector(JettyContainer container, ThreadPool threadPool) {
        super(container, new SelectChannelConnector(), threadPool, "HTTPSelectChannelConnector");
    }
View Full Code Here

    public int getDefaultPort() {
        return 80;
    }

    public void setRedirectPort(int port) {
        SelectChannelConnector connector = (SelectChannelConnector) listener;
        connector.setConfidentialPort(port);
        connector.setIntegralPort(port);
        connector.setIntegralScheme("https");
        connector.setConfidentialScheme("https");
    }
View Full Code Here

        return https.getKeyAlias();
    }

    //TODO does this make sense???
    public void setRedirectPort(int port) {
        SelectChannelConnector socketListener = (SelectChannelConnector) listener;
        socketListener.setConfidentialPort(port);
        socketListener.setIntegralPort(port);
        socketListener.setIntegralScheme("https");
        socketListener.setConfidentialScheme("https");
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.nio.SelectChannelConnector

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.