Federico Mariani created CAMEL-26988:
----------------------------------------
Summary: camel-servlet: Rest DSL consumers ignore
attachmentMultipartBinding, mapHttpMessageBody, logException and
fileNameExtWhitelist
Key: CAMEL-26988
URL: https://issues.apache.org/jira/browse/CAMEL-26988
Project: Camel
Issue Type: Bug
Components: camel-servlet
Affects Versions: 4.18.5, 4.23.0, 4.22.2
Reporter: Federico Mariani
Fix For: 4.24.0
The servlet Rest DSL consumer always installs a new {{ServletRestHttpBinding}}
that copies only some of the endpoint options. {{attachmentMultipartBinding}},
{{fileNameExtWhitelist}}, {{logException}} and {{mapHttpMessageBody}}, set with
{{restConfiguration().endpointProperty(...)}} or on the component, have no
effect. A {{ServletRestHttpBinding}} set as the component {{httpBinding}} is
replaced as well.
{code:java}
restConfiguration().component("servlet").endpointProperty("attachmentMultipartBinding",
"true");
rest("/upload").post().to("direct:upload");
from("direct:upload").process(e -> e.getMessage().setBody(
e.getMessage(AttachmentMessage.class).getAttachment("file") != null ?
"attached" : "no attachment"));
{code}
A multipart/form-data POST to {{/upload}} answers "no attachment", while
{{from("servlet:upload?attachmentMultipartBinding=true")}} binds the part. With
{{endpointProperty("mapHttpMessageBody", "false")}} the Rest DSL consumer still
reads the body.
Expected: the Rest DSL binding is built from all the endpoint options, as
{{ServletEndpoint.getHttpBinding()}} does, and still maps the path placeholders.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)