Arnaud Masciotra created CXF-6180:
-------------------------------------
Summary: Bad parse of Multipart request
Key: CXF-6180
URL: https://issues.apache.org/jira/browse/CXF-6180
Project: CXF
Issue Type: Bug
Components: JAX-RS
Affects Versions: 3.0.3
Environment: Java 1.7
Reporter: Arnaud Masciotra
A valid HTTP request POST with Multipart get an HTTP ERROR 400 Bad request,
because the content is not well parsed by CXF
--------------------------------
POST http://localhost:8080/ws/test/test HTTP/1.1
Content-Length: 196
Content-Type: multipart/form-data; boundary=MultiPart; charset=UTF-8
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.0.1 (java 1.5)
Expect: 100-Continue
--MultiPart
Content-Disposition: form-data; name="foo"
Content-Type: text/plain
Foo Content
--MultiPart
Content-Disposition: form-data; name="bar"
Content-Type: text/html
Bar Content
--MultiPart
--------------------------------
Server side code :
@Path("/test")
public class TestWebService
{
@POST
@Path("/test")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void test(@Multipart(value = "foo") String foo, @Multipart(value =
"bar") String bar) {
// DO NOTHING BECAUSE OF THE HTTP ERROR 400 !
}
}
--------------------------------
The cause is the first Header of the Second Attachment is not well read ...
The C of "Content-Disposition" is missing !
Then the method getContentDisposition() of the second Attachment is always null
...
headers ArrayList in AttanchmentImpl isn't well construct ...
If you add a useless character in front of "Content-Disposition" header, then I
got a valid response (in this case, HTTP 204)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)