[ 
https://issues.apache.org/jira/browse/CXF-6180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14269580#comment-14269580
 ] 

Daniel Kulp commented on CXF-6180:
----------------------------------

The request is not a valid mime request which is why it's not working.  Per 
spec, the headers in the request (and the boundary markers) must be separated 
by CRLF (2 bytes).   The request is only using CR.  

> 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
>         Attachments: issue-cxf-6180.zip
>
>
> 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)

Reply via email to