use of org.eclipse.jetty.server.HttpConnectionFactory in project gocd by gocd.
the class FakeGoServer method sslConnector.
public Connector sslConnector(File keystore, File truststore, int sslPort) {
HttpConfiguration httpsConfig = new HttpConfiguration();
httpsConfig.setOutputBufferSize(RESPONSE_BUFFER_SIZE);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(keystore.getAbsolutePath());
sslContextFactory.setKeyStorePassword(PASSWORD);
sslContextFactory.setKeyManagerPassword(PASSWORD);
sslContextFactory.setTrustStorePath(truststore.getAbsolutePath());
sslContextFactory.setTrustStorePassword(PASSWORD);
sslContextFactory.setWantClientAuth(true);
ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
https.setPort(sslPort);
https.setIdleTimeout(MAX_IDLE_TIME);
return https;
}
use of org.eclipse.jetty.server.HttpConnectionFactory in project Openfire by igniterealtime.
the class HttpBindManager method createSSLConnector.
private void createSSLConnector(int securePort) {
httpsConnector = null;
try {
final IdentityStore identityStore = XMPPServer.getInstance().getCertificateStoreManager().getIdentityStore(ConnectionType.BOSH_C2S);
if (securePort > 0 && identityStore.getStore().aliases().hasMoreElements()) {
if (!identityStore.containsDomainCertificate("RSA")) {
Log.warn("HTTP binding: Using RSA certificates but they are not valid for " + "the hosted domain");
}
final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager());
final ConnectionConfiguration configuration = connectionManager.getListener(ConnectionType.BOSH_C2S, true).generateConnectionConfiguration();
final SslContextFactory sslContextFactory = new EncryptionArtifactFactory(configuration).getSslContextFactory();
final HttpConfiguration httpsConfig = new HttpConfiguration();
httpsConfig.setSecureScheme("https");
httpsConfig.setSecurePort(securePort);
configureProxiedConnector(httpsConfig);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
final ServerConnector sslConnector;
if ("npn".equals(JiveGlobals.getXMLProperty("spdy.protocol", ""))) {
sslConnector = new HTTPSPDYServerConnector(httpBindServer, sslContextFactory);
} else {
sslConnector = new ServerConnector(httpBindServer, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
}
sslConnector.setHost(getBindInterface());
sslConnector.setPort(securePort);
httpsConnector = sslConnector;
}
} catch (Exception e) {
Log.error("Error creating SSL connector for Http bind", e);
}
}
use of org.eclipse.jetty.server.HttpConnectionFactory in project killbill by killbill.
the class HttpServer method configureMainConnector.
private ServerConnector configureMainConnector(final HttpConfiguration httpConfiguration, final boolean isStatsOn, final String localIp, final int localPort) {
final ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
http.setHost(localIp);
http.setPort(localPort);
if (isStatsOn) {
final ConnectorStatistics stats = new ConnectorStatistics();
http.addBean(stats);
}
return http;
}
use of org.eclipse.jetty.server.HttpConnectionFactory in project rest.li by linkedin.
the class HttpJettyServer method getConnectors.
protected Connector[] getConnectors(Server server) {
HttpConfiguration configuration = new HttpConfiguration();
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(configuration, HttpCompliance.RFC2616));
connector.setPort(_port);
return new Connector[] { connector };
}
use of org.eclipse.jetty.server.HttpConnectionFactory in project camel by apache.
the class CxfPayloadRouterContentLengthTest method setUp.
@Before
public void setUp() throws Exception {
/*
* We start a Jetty for the service in order to have better control over
* the response The response must contain only a Content-Type and a
* Content-Length but no other header
*/
log.info("Starting jetty server at port {}", JETTY_PORT);
server = new Server();
// Do not send a Server header
HttpConfiguration httpconf = new HttpConfiguration();
httpconf.setSendServerVersion(false);
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpconf));
http.setPort(JETTY_PORT);
server.addConnector(http);
server.setHandler(new AbstractHandler() {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/xml");
// the Content-Length is correct for this response message
response.setContentLength(RESPONSE_MESSAGE.length());
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
PrintWriter pw = response.getWriter();
pw.write(RESPONSE_MESSAGE);
pw.close();
}
});
server.start();
// Load the CXF endpoints for the route
log.info("Start Routing Scenario at port {}", CXFTestSupport.getPort1());
applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/CxfPayloadRouterContentLengthBeans.xml");
super.setUp();
assertNotNull("Should have created a valid spring context", applicationContext);
}
Aggregations