Package org.springframework.boot.context.embedded.tomcat

Examples of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory


      return new DispatcherServlet();
    }

    @Bean
    public EmbeddedServletContainerFactory embeddedServletContainer() {
      TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
      factory.setPort(this.port);
      return factory;
    }
View Full Code Here


    return SocketUtils.findAvailableTcpPort();
  }

  @Bean
  public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
    tomcat.addAdditionalTomcatConnectors(createSslConnector());
    return tomcat;
  }
View Full Code Here

  @Configuration
  @Import(Config.class)
  public static class TomcatConfig {
    @Bean
    public EmbeddedServletContainerFactory containerFactory() {
      return new TomcatEmbeddedServletContainerFactory(0);
    }
View Full Code Here

  @Configuration
  public static class ContainerWithNoMultipartTomcat {

    @Bean
    TomcatEmbeddedServletContainerFactory containerFactory() {
      return new TomcatEmbeddedServletContainerFactory();
    }
View Full Code Here

      return new MultipartConfigElement("");
    }

    @Bean
    TomcatEmbeddedServletContainerFactory containerFactory() {
      return new TomcatEmbeddedServletContainerFactory();
    }
View Full Code Here

          return;
        }
        Assert.state(container instanceof TomcatEmbeddedServletContainerFactory,
            "Websockets are currently only supported in Tomcat (found "
                + container.getClass() + "). ");
        TomcatEmbeddedServletContainerFactory tomcatContainer = (TomcatEmbeddedServletContainerFactory) container;
        tomcatContainer.addContextCustomizers(new TomcatContextCustomizer() {
          @Override
          public void customize(Context context) {
            addListener(context, findListenerType());
          }
        });
View Full Code Here

  @ConditionalOnMissingBean(value = EmbeddedServletContainerFactory.class, search = SearchStrategy.CURRENT)
  public static class EmbeddedTomcat {

    @Bean
    public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() {
      return new TomcatEmbeddedServletContainerFactory();
    }
View Full Code Here

    Map<String, String> map = new HashMap<String, String>();
    map.put("server.tomcat.remote_ip_header", "");
    map.put("server.tomcat.protocol_header", "");
    bindProperties(map);

    TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
    this.properties.customize(container);

    assertEquals(0, container.getValves().size());
  }
View Full Code Here

    // Since 1.1.7 you need to specify at least the protocol and ip properties
    map.put("server.tomcat.protocol_header", "x-forwarded-proto");
    map.put("server.tomcat.remote_ip_header", "x-forwarded-for");
    bindProperties(map);

    TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
    this.properties.customize(container);

    assertEquals(1, container.getValves().size());
    Valve valve = container.getValves().iterator().next();
    assertThat(valve, instanceOf(RemoteIpValve.class));
    RemoteIpValve remoteIpValve = (RemoteIpValve) valve;
    assertEquals("x-forwarded-proto", remoteIpValve.getProtocolHeader());
    assertEquals("x-forwarded-for", remoteIpValve.getRemoteIpHeader());
View Full Code Here

    map.put("server.tomcat.protocol_header", "x-my-protocol-header");
    map.put("server.tomcat.internal_proxies", "192.168.0.1");
    map.put("server.tomcat.port-header", "x-my-forward-port");
    bindProperties(map);

    TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
    this.properties.customize(container);

    assertEquals(1, container.getValves().size());
    Valve valve = container.getValves().iterator().next();
    assertThat(valve, instanceOf(RemoteIpValve.class));
    RemoteIpValve remoteIpValve = (RemoteIpValve) valve;
    assertEquals("x-my-protocol-header", remoteIpValve.getProtocolHeader());
    assertEquals("x-my-remote-ip-header", remoteIpValve.getRemoteIpHeader());
    assertEquals("x-my-forward-port", remoteIpValve.getPortHeader());
View Full Code Here

TOP

Related Classes of org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.