connector = (Connector) Class.forName(HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME).newInstance();
if (keyStore.startsWith("classpath:")) { try { String res = keyStore.substring(10); URL resurl = new ClassPathResource(res).getURL(); keyStore = resurl.toString(); } catch (IOException e) { throw new JBIException("Unable to find keystore " + keyStore, e); } } String keyStorePassword = ssl.getKeyStorePassword(); if (keyStorePassword == null) { keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword"); if (keyStorePassword == null) { throw new IllegalArgumentException("keyStorePassword or system property javax.net.ssl.keyStorePassword must be set"); } } SslSocketConnector sslConnector = new SslSocketConnector(); sslConnector.setAlgorithm(ssl.getAlgorithm()); sslConnector.setProtocol(ssl.getProtocol()); sslConnector.setConfidentialPort(url.getPort()); sslConnector.setPassword(ssl.getKeyStorePassword()); sslConnector.setKeyPassword(ssl.getKeyPassword() != null ? ssl.getKeyPassword() : keyStorePassword); sslConnector.setKeystore(keyStore); sslConnector.setKeystoreType(ssl.getKeyStoreType()); sslConnector.setNeedClientAuth(ssl.isNeedClientAuth()); sslConnector.setWantClientAuth(ssl.isWantClientAuth()); connector = sslConnector; } else { String connectorClassName = configuration.getJettyConnectorClassName(); try { connector = (Connector) Class.forName(connectorClassName).newInstance(); } catch (Exception e) { logger.warn("Could not create a jetty connector of class '" + connectorClassName + "'. Defaulting to " + HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME); if (logger.isDebugEnabled()) { logger.debug("Reason: " + e.getMessage(), e); } connector = (Connector) Class.forName(HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME).newInstance(); }
    protected Server createServer(URL url) throws Exception {        if (!url.getProtocol().equals("http")) {            // TODO: handle https ?            throw new UnsupportedOperationException("Protocol " + url.getProtocol() + " is not supported");        }        // Create a new server        String connectorClassName = configuration.getJettyConnectorClassName();        Connector connector;        try {            connector = (Connector) Class.forName(connectorClassName).newInstance();        } catch (Exception e) {            logger.warn("Could not create a jetty connector of class '" + connectorClassName + "'. Defaulting to " + HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME);            if (logger.isDebugEnabled()) {                logger.debug("Reason: " + e.getMessage(), e);            }            connector = (Connector) Class.forName(HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME).newInstance();        }        connector.setHost(url.getHost());        connector.setPort(url.getPort());        Server server = new Server();        server.setThreadPool(threadPool);        server.setConnectors(new Connector[] { connector });        server.setNotFoundHandler(new DisplayServiceHandler());        connector.start();        server.start();        String key = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort();        servers.put(key, server);        return server;    }