Java 类org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory 实例源码

项目:loc-framework    文件:TomcatGracefulShutdownAutoConfiguration.java   
@Bean
public WebServerFactoryCustomizer tomcatFactoryCustomizer() {
  return server -> {
    if (server instanceof TomcatServletWebServerFactory) {
      ((TomcatServletWebServerFactory) server).addConnectorCustomizers(tomcatGracefulShutdown());
    }
  };
}
项目:servlet4-demo    文件:Application.java   
/**
 * Create a Tomcat customizer bean to allow Tomcat to speak http2.
 * @return the TomcatServletWebServerFactory
 */
@Bean
public TomcatServletWebServerFactory tomcatCustomizer() {
  TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
  factory.addConnectorCustomizers((connector -> {
    connector.addUpgradeProtocol(new Http2Protocol());
  }));
  return factory;
}
项目:servlet4-demo    文件:ApplicationTest.java   
@Test
public void testTomcatCustomizer() {
  TomcatServletWebServerFactory factory = sut.tomcatCustomizer();
  @SuppressWarnings("unchecked")
  List<TomcatConnectorCustomizer> tomcatConnectorCustomizers = new ArrayList(factory.getTomcatConnectorCustomizers());
  assertTrue(tomcatConnectorCustomizers.size() == 1);
}
项目:servlet4-demo    文件:ApplicationTest.java   
@Test
public void testCustomize() {
  TomcatServletWebServerFactory factory = sut.tomcatCustomizer();
  @SuppressWarnings("unchecked")
  List<TomcatConnectorCustomizer> tomcatConnectorCustomizers = new ArrayList(factory.getTomcatConnectorCustomizers());
  TomcatConnectorCustomizer customizer = tomcatConnectorCustomizers.get(0);

  assertNotNull(customizer);
  customizer.customize(connector);
  verify(connector, times(1)).addUpgradeProtocol(any(Http2Protocol.class));
}
项目:joinfaces    文件:TomcatSpringBootAutoConfigurationIT.java   
@Test
public void customize() throws MalformedURLException {
    TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory();

    TomcatSpringBootAutoConfiguration tomcatSpringBootAutoConfiguration = new TomcatSpringBootAutoConfiguration();

    tomcatSpringBootAutoConfiguration.customize(tomcatFactory);

    assertThat(tomcatFactory.getTomcatContextCustomizers())
        .isNotEmpty();
}
项目:joinfaces    文件:TomcatSpringBootAutoConfigurationIT.java   
@Test
public void doNotCustomize() throws MalformedURLException {
    TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory();

    TomcatSpringBootAutoConfiguration tomcatSpringBootAutoConfiguration = new TomcatSpringBootAutoConfiguration();

    tomcatSpringBootAutoConfiguration.customize(tomcatFactory);

    assertThat(tomcatFactory.getTomcatConnectorCustomizers())
        .isEmpty();
}
项目:logback-access-spring-boot-starter    文件:TomcatLogbackAccessInstaller.java   
/** {@inheritDoc} */
@Override
protected void installLogbackAccess(TomcatServletWebServerFactory container) {
    LogbackAccessTomcatValve valve = new LogbackAccessTomcatValve(
            logbackAccessProperties, environment, applicationEventPublisher);
    container.addEngineValves(valve);
    log.debug("Installed Logback-access: container=[{}]", container);
}
项目:spring-security-oauth2-boot    文件:OAuth2AutoConfigurationTests.java   
@Bean
TomcatServletWebServerFactory webServerFactory() {
    return new TomcatServletWebServerFactory(0);
}
项目:joinfaces    文件:TomcatSpringBootAutoConfiguration.java   
@Override
public void customize(TomcatServletWebServerFactory container) {
    container.addContextCustomizers(this.customizer);
}
项目:joinfaces    文件:JoinfacesTestConfiguration.java   
@Bean
public TomcatServletWebServerFactory tomcatServletWebServerFactory() {
    return new TomcatServletWebServerFactory();
}