Christian Mattar created CXF-9111:
-------------------------------------

             Summary: Default behavior for "multipart/form-data" requests not 
standard-conform
                 Key: CXF-9111
                 URL: https://issues.apache.org/jira/browse/CXF-9111
             Project: CXF
          Issue Type: Bug
    Affects Versions: 4.0.6
            Reporter: Christian Mattar


We are using a client interface like this:
{noformat}
    @POST
    @Path("/checkMultipartAsAttachment")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    void checkMultipartAsObject(@Multipart(value = "part1", type = 
MediaType.APPLICATION_JSON) JsonData part1,  @Multipart(value = "part1", type = 
MediaType.APPLICATION_JSON) JsonData part2);{noformat}
 

However, the multiparts are not recognized by e.g. Spring MVC. When inspecting 
the internal CXF data structures, I can see that the generated Attachment 
objects have no Content-Disposition header, and thus, no Content-Disposition 
header is sent through the wire.

Instead, a "Content-ID" header is sent. This header is also picked up by CXF on 
server-side, so CXF->CXF communication works.


As far as I can tell, the currently generated request is not valid for MIME 
type "multipart/form-data" according to the relevant 
https://datatracker.ietf.org/doc/html/rfc7578 .
(it might by valid for MIME type "multipart/related" according to 
https://www.ietf.org/rfc/rfc2387.txt)

The same holds true by default for requests like this:

 
{noformat}
    @POST
    @Path("/checkMultipartAsAttachment")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    void checkMultipartAsAttachment(Attachment multipart);
{noformat}

However, in these cases we could at least add the Content-Disposition Header to 
the Attachment-object in our own code.

It would be great if by default, requests for "multipart/form-data" would be 
standards-conform.



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

Reply via email to