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;
  }
Ejemplo n.º 2
0
 public static <T> T config(ConfigProvider<T> provider) {
   return provider.defaultReadConfig().findFirst().get();
 }