Ejemplo n.º 1
0
  @Bean
  public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory(
      ConfigProvider<UndertowConfig> cfg) {

    int port = cfg.defaultReadConfig().findFirst().get().getPort();

    UndertowEmbeddedServletContainerFactory factory =
        new UndertowEmbeddedServletContainerFactory(port);

    factory.addBuilderCustomizers(
        (UndertowBuilderCustomizer)
            builder -> { // (*)
              builder.setServerOption(UndertowOptions.DECODE_URL, true);
              builder.setServerOption(UndertowOptions.URL_CHARSET, StandardCharsets.UTF_8.name());
            });

    factory.addDeploymentInfoCustomizers(
        (UndertowDeploymentInfoCustomizer)
            deployment -> { // (*)
              deployment.setDefaultEncoding(StandardCharsets.UTF_8.name());
            });

    return factory;
  }
 @Override
 protected void doCustomize(UndertowEmbeddedServletContainerFactory container) {
   WebsocketDeploymentInfoCustomizer customizer = new WebsocketDeploymentInfoCustomizer();
   container.addDeploymentInfoCustomizers(customizer);
 }