本文整理汇总了Java中org.eclipse.jetty.http.HttpScheme.HTTPS属性的典型用法代码示例。如果您正苦于以下问题:Java HttpScheme.HTTPS属性的具体用法?Java HttpScheme.HTTPS怎么用?Java HttpScheme.HTTPS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jetty.http.HttpScheme
的用法示例。
在下文中一共展示了HttpScheme.HTTPS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyConfiguration
/**
* Verifies all the needed bits are present in Jetty XML configuration (as HTTPS must be enabled by users).
*/
private void verifyConfiguration(final HttpScheme httpScheme) {
try {
if (HttpScheme.HTTP == httpScheme) {
bean(HTTP_CONFIG_ID, HttpConfiguration.class);
bean(HTTP_CONNECTOR_ID, ServerConnector.class);
}
else if (HttpScheme.HTTPS == httpScheme) {
bean(SSL_CONTEXT_FACTORY_ID, SslContextFactory.class);
bean(HTTPS_CONFIG_ID, HttpConfiguration.class);
bean(HTTPS_CONNECTOR_ID, ServerConnector.class);
}
else {
throw new UnsupportedHttpSchemeException(httpScheme);
}
}
catch (IllegalStateException e) {
throw new IllegalStateException("Jetty HTTPS is not enabled in Nexus", e);
}
}
示例2: defaultHttpConfiguration
/**
* Returns the OOTB defined configuration for given HTTP scheme.
*/
private HttpConfiguration defaultHttpConfiguration(final HttpScheme httpScheme) {
if (HttpScheme.HTTP == httpScheme) {
return bean(HTTP_CONFIG_ID, HttpConfiguration.class);
}
else if (HttpScheme.HTTPS == httpScheme) {
return bean(HTTPS_CONFIG_ID, HttpConfiguration.class);
}
else {
throw new UnsupportedHttpSchemeException(httpScheme);
}
}
示例3: defaultConnector
/**
* Returns the OOTB defined connector for given HTTP scheme.
*/
private ServerConnector defaultConnector(final HttpScheme httpScheme) {
if (HttpScheme.HTTP == httpScheme) {
return bean(HTTP_CONNECTOR_ID, ServerConnector.class);
}
else if (HttpScheme.HTTPS == httpScheme) {
return bean(HTTPS_CONNECTOR_ID, ServerConnector.class);
}
else {
throw new UnsupportedHttpSchemeException(httpScheme);
}
}
示例4: addConnector
/**
* Adds and starts connector to Jetty based on passed in configuration.
*/
public ServerConnector addConnector(final ConnectorConfiguration connectorConfiguration)
{
final HttpScheme httpScheme = connectorConfiguration.getScheme();
verifyConfiguration(httpScheme);
final HttpConfiguration httpConfiguration =
connectorConfiguration.customize(defaultHttpConfiguration(httpScheme));
final ServerConnector connectorPrototype =
defaultConnector(httpScheme);
final ServerConnector serverConnector;
if (HttpScheme.HTTP == httpScheme) {
serverConnector = new ServerConnector(
server,
connectorPrototype.getAcceptors(),
connectorPrototype.getSelectorManager().getSelectorCount(),
new InstrumentedConnectionFactory(
new HttpConnectionFactory(httpConfiguration)
)
);
}
else if (HttpScheme.HTTPS == httpScheme) {
final SslContextFactory sslContextFactory = bean(SSL_CONTEXT_FACTORY_ID, SslContextFactory.class);
serverConnector = new ServerConnector(
server,
connectorPrototype.getAcceptors(),
connectorPrototype.getSelectorManager().getSelectorCount(),
new InstrumentedConnectionFactory(
new SslConnectionFactory(sslContextFactory, "http/1.1")
),
new HttpConnectionFactory(httpConfiguration)
);
}
else {
throw new UnsupportedHttpSchemeException(httpScheme);
}
serverConnector.setHost(connectorPrototype.getHost());
serverConnector.setPort(connectorConfiguration.getPort());
serverConnector.setIdleTimeout(connectorPrototype.getIdleTimeout());
serverConnector.setSoLingerTime(connectorPrototype.getSoLingerTime());
serverConnector.setAcceptorPriorityDelta(connectorPrototype.getAcceptorPriorityDelta());
serverConnector.setAcceptQueueSize(connectorPrototype.getAcceptQueueSize());
managedConnectors.put(connectorConfiguration, serverConnector);
server.addConnector(serverConnector);
try {
serverConnector.start();
}
catch (Exception e) {
log.warn("Could not start connector: {}", connectorConfiguration, e);
throw new RuntimeException(e);
}
return serverConnector;
}