Also - let me know please how the receiving method signature looks like Cheers, Sergey
On Thu, Jul 21, 2011 at 12:41 AM, Sergey Beryozkin <[email protected]> wrote: > Hi > > On Wed, Jul 20, 2011 at 5:32 PM, Collard, David L (Dave) > <[email protected]> wrote: >> I am processing multipart form-data for file uploads using JAX-RS. >> Using Apache CXF 2.4.1 >> >> >> The example addBookFilesForm shown here is not working as-is for me: >> http://cxf.apache.org/docs/jax-rs-multiparts.html#JAX-RSMultiparts-Uploadingfiles >> >> Has an example request here: >> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormJsonFiles >> >> The second part of the form data is a multipart/mixed list of books. >> The relevant snippet of the above request is: >> >> >> Cntent-Disposition: form-data; name="files" >> >> Content-Type: multipart/mixed; boundary=_Part_4_701508.1145579811786 >> >> This fails for me with >> >> WARNING: No multipart with content id files found >> >> If I add >> Content-Id:<files> >> >> to the request, then it works fine. >> >> Should it not use the name if the Content-ID is not specified? >> Is there something I can do to not require this Content-Id and use the name? >> It is not >> in my interface spec so hope to avoid requiring it. >> > That is a bit strange given that I can see this test working for me, > here is the trace: > > POST /bookstore/books/filesform HTTP/1.1 > Content-Type: multipart/form-data; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB > User-Agent: Jakarta Commons-HttpClient/3.1 > Host: localhost:8081 > Content-Length: 759 > > > --bqJky99mlBWa-ZuqjC53mG6EzbmlxB > Content-Disposition: form-data; name="owner" > Content-Type: text/plain > > Larry > --bqJky99mlBWa-ZuqjC53mG6EzbmlxB > Content-Disposition: form-data; name="files" > Content-Type: multipart/mixed; boundary=_Part_4_701508.1145579811786 > > --_Part_4_701508.1145579811786 > Content-Disposition: form-data; name="book1" > Content-Type: application/json; charset=US-ASCII > Content-Transfer-Encoding: 8bit > > {"Book":{"name":"CXF in Action - 1","id":123}} > --_Part_4_701508.1145579811786 > Content-Disposition: form-data; name="book2" > Content-Type: application/json; charset=US-ASCII > Content-Transfer-Encoding: 8bit > > {"Book":{"name":"CXF in Action - 2","id":124}} > --_Part_4_701508.1145579811786-- > --bqJky99mlBWa-ZuqjC53mG6EzbmlxB-- > > and the output is OK. > I also recall updating the code to check Content-Disposition if > Content-Id is missing. > > Are you using Struts by any chance ? Here are some hints just in case: > > http://cxf.apache.org/docs/jax-rs-multiparts.html#JAX-RSMultiparts-NoteaboutStruts > >> >> On another note, there is an error in the addBookJaxbJsonForm example, the >> request has >> >> Content-ID: <jaxbPart> >> >> But the signature specifies "bookXML" not jaxbPart. >> >> > Fixed - should be propagated shortly > > thanks, Sergey >> >> Thanks! >> >> >> >> -- DC >> >> [email protected] >> >> >> >> > > > > -- > Sergey Beryozkin > > http://sberyozkin.blogspot.com > Talend - http://www.talend.com >
