isSsl = true;
} else if (!url.getProtocol().equals("http")) {
throw new UnsupportedOperationException("Protocol " + url.getProtocol() + " is not supported");
}
// Create a new server
Connector connector;
if (isSsl && ssl.isManaged()) {
connector = setupManagerSslConnector(url, ssl);
} else if (isSsl) {
connector = setupSslConnector(url, ssl);
} 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();
}
}
connector.setHost(url.getHost());
connector.setPort(url.getPort());
connector.setMaxIdleTime(this.configuration.getConnectorMaxIdleTime());
Server server = new Server();
server.setThreadPool(new ThreadPoolWrapper());
server.setConnectors(new Connector[] {connector});
ContextHandlerCollection contexts = new ContextHandlerCollection();
HandlerCollection handlers = new HandlerCollection();