Hi Paul
Paul Sandoz wrote:
>
>> Through a lot of brute force debugging, I've narrowed down the
>> problem to a single line in the request.
>>
>> This works:
>> Content-Type: multipart/form-data;
>> boundary=----------------------------4e1144df2bb2
>>
>> While this does not:
>> Content-Type: multipart/form-
>> data;boundary=----------------------------4e1144df2bb2
>>
>
I believe I am running into this same problem when trying to post a jpg to a
Ruby on Rails "service end point". I'm coding a RESTful client using
jersey, which produces this output:
--Boundary_1_7290583_1268425967724
Content-Type: text/plain
Content-Disposition: form-data;name="filename"
IMG_0168.jpg
--Boundary_1_6270141_1268366891364
Content-Type: image/jpg
Content-Disposition: form-data;name="file"
Notice the lack of whitespace between the semi-colon and the tokens around
it.
I copy and pasted your code as provided below. My current, non-working code
looks like this:
File file = new File("/Users/steve/Desktop/IMG_0168.jpg");
FormDataMultiPart multiPart = new
FormDataMultiPart().field("filename", file.getName())
.field("file", file, MediaType.valueOf("image/jpg"));
ClientResponse response =
r.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class,
multiPart);
I'm wondering, how do I consume the MediaTypeProvider that I have created in
the above snippet? Also, I noticed in the toString method this:
WriterUtil.appendQuotedMediaType(b, e.getValue());
What is WriterUtil? I just put b.append(e.getValue()) since I couldn't find
anything out about WriterUtil.
Thanks so much for any insight you can provide.
-Steve
--
View this message in context: http://n2.nabble.com/Multipart-Post-tp4252846p4724316.html
Sent from the Jersey mailing list archive at Nabble.com.