org.eclipse.jetty.server.ssl.SslSelectChannelConnector Java Examples
The following examples show how to use
org.eclipse.jetty.server.ssl.SslSelectChannelConnector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestClient1.java From rice with Educational Community License v2.0 | 4 votes |
/** * Creates a Server that exposes the TestClient1 services via http and https * * @return the Server instance */ @Override protected Server createServer() { // Need this CredentialsSourceFactory in our config to enable our test of basic auth // with our httpInvoker-echoServiceSecure registerTestCredentialsSourceFactory(); ConfigConstants configConstants = new ConfigConstants(); Server server = new Server(); SelectChannelConnector connector0 = new SelectChannelConnector(); connector0.setPort(configConstants.SERVER_HTTP_PORT); connector0.setMaxIdleTime(30000); connector0.setRequestHeaderSize(8192); SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector(); ssl_connector.setPort(configConstants.SERVER_HTTPS_PORT); SslContextFactory cf = ssl_connector.getSslContextFactory(); cf.setKeyStore(configConstants.KEYSTORE_PATH); cf.setKeyStorePassword(configConstants.KEYSTORE_PASS); cf.setKeyManagerPassword(configConstants.KEYSTORE_PASS); server.setConnectors(new Connector[]{connector0, ssl_connector}); URL webRoot = getClass().getClassLoader().getResource(configConstants.WEB_ROOT); String location = webRoot.getPath(); LOG.debug("#####################################"); LOG.debug("#"); LOG.debug("# Starting Client1 using following web root " + location); LOG.debug("#"); LOG.debug("#####################################"); WebAppContext context = new WebAppContext(); context.setResourceBase(location); context.setContextPath(configConstants.CONTEXT); HandlerCollection handlers = new HandlerCollection(); handlers.addHandler(context); server.setHandler(handlers); server.setDumpAfterStart(true); //server.setDumpBeforeStop(true); return server; }