当前位置: 首页>>代码示例>>Java>>正文


Java HttpScheme.HTTPS属性代码示例

本文整理汇总了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);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:ConnectorManager.java

示例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);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:ConnectorManager.java

示例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);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:ConnectorManager.java

示例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;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:57,代码来源:ConnectorManager.java


注:本文中的org.eclipse.jetty.http.HttpScheme.HTTPS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。