@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; }
@Bean public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() { UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory(); factory.addBuilderCustomizers(new UndertowBuilderCustomizer() { @Override public void customize(Undertow.Builder builder) { builder.addHttpListener(8080, "0.0.0.0"); } }); return factory; }
private void customizeConnectionTimeout( UndertowEmbeddedServletContainerFactory factory, final int connectionTimeout) { factory.addBuilderCustomizers(new UndertowBuilderCustomizer() { @Override public void customize(Builder builder) { builder.setSocketOption(UndertowOptions.NO_REQUEST_TIMEOUT, connectionTimeout); } }); }
private void customizeMaxHttpHeaderSize( UndertowEmbeddedServletContainerFactory factory, final int maxHttpHeaderSize) { factory.addBuilderCustomizers(new UndertowBuilderCustomizer() { @Override public void customize(Builder builder) { builder.setServerOption(UndertowOptions.MAX_HEADER_SIZE, maxHttpHeaderSize); } }); }
private void customizeMaxHttpPostSize( UndertowEmbeddedServletContainerFactory factory, final int maxHttpPostSize) { factory.addBuilderCustomizers(new UndertowBuilderCustomizer() { @Override public void customize(Builder builder) { builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, (long) maxHttpPostSize); } }); }
@Bean UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() { UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory(); factory.addBuilderCustomizers(new UndertowBuilderCustomizer() { @Override public void customize(Builder builder) { builder.setIoThreads(Runtime.getRuntime().availableProcessors() * 2); } }); return factory; }