On 3/8/12 11:49 PM, Jason Lee wrote:
> It seems like I ask more questions than anyone else on the list
> (thanks for the help BTW :), and maybe someday I can fix that, but...
> I have another question. :)
feel free to post as many questions as you want/can ;)
>
> I'm trying to figure out how to do a submit with a file upload. The
> scenario is basically identical to an HTML form submission with a file
> input (i.e, I have several text fields that I need to POST along with
> an arbitrary number of files). Using the Jersey 1.x client, I did
> something like this (from a unit test, fwiw):
>
> FormDataMultiPart form = new FormDataMultiPart();
> for (Map.Entry<String, Object> entry : payload.entrySet()) {
> if ((entry.getValue() instanceof File)) {
> form.getBodyParts().add((new
> FileDataBodyPart(entry.getKey(), (File)entry.getValue())));
> } else {
> form.field(entry.getKey(), entry.getValue(),
> MediaType.TEXT_PLAIN_TYPE);
> }
> }
>
> Right or wrong, it worked. :) I've been digging through the Jersey
> source, tests, etc all day and haven't found the 2.0 analog. Is this
> supported yet, or am I just missing it?
Unfortunately for you, 2.0 doesn't support multipart and form param
processing yet.
Regards,
Pavel
>
> Thanks again! :)
>