Federico Mariani created CAMEL-23682:
----------------------------------------

             Summary: camel-undertow - Expose common UndertowOptions on 
UndertowHostOptions for server-level configuration
                 Key: CAMEL-23682
                 URL: https://issues.apache.org/jira/browse/CAMEL-23682
             Project: Camel
          Issue Type: Improvement
          Components: camel-undertow
    Affects Versions: 4.20.0
            Reporter: Federico Mariani


Currently, {{UndertowHostOptions}} only exposes five configuration options: 
{{workerThreads}}, {{ioThreads}}, {{bufferSize}}, {{directBuffers}}, and 
{{http2Enabled}}. The underlying {{Undertow.Builder}} supports many more server 
options via {{setServerOption()}}, but these are not accessible through Camel's 
configuration.

Users who need to configure common production settings like request body size 
limits, header size limits, or connection timeouts must resort to workarounds, 
either replacing the entire {{UndertowComponent}} or using custom 
{{CamelUndertowHttpHandler}} implementations.

h3. Proposed Change

Add typed fields to {{UndertowHostOptions}} for the most commonly needed 
{{UndertowOptions}}, following the same pattern used for {{http2Enabled}}:

||Option||Type||Undertow Default||Description||
|{{maxEntitySize}}|{{Long}}|2 MB|Maximum size of the HTTP entity body|
|{{multipartMaxEntitySize}}|{{Long}}|2 MB|Maximum size of a multipart entity 
body|
|{{maxHeaderSize}}|{{Integer}}|1 MB|Maximum size of an HTTP request header|
|{{noRequestTimeout}}|{{Integer}} (ms)|60000|Time a connection can idle with no 
active request before being closed|
|{{idleTimeout}}|{{Integer}} (ms)|none|Idle timeout after which the channel 
will be closed|
|{{requestParseTimeout}}|{{Integer}} (ms)|-1 (disabled)|Maximum time to parse 
an HTTP request|
||Option||Type||Undertow Default||Description||
|{{maxParameters}}|{{Integer}}|1000|Maximum number of query/POST parameters to 
parse|
|{{maxHeaders}}|{{Integer}}|200|Maximum number of HTTP headers to parse|

Each field would be wired in {{DefaultUndertowHost}} as:
{code:java}
if (options.getMaxEntitySize() != null) {
    builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, 
options.getMaxEntitySize());
}
{code}

h3. Configuration Example

{code:properties}
camel.component.undertow.host-options.max-entity-size=10485760
camel.component.undertow.host-options.max-header-size=65536
camel.component.undertow.host-options.no-request-timeout=30000
camel.component.undertow.host-options.request-parse-timeout=5000
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to