users@jersey.java.net

Re: [Jersey] [RFC] Patches regarding file body part - Re: [Jersey] Uploading files using Jersey client

From: Imran M Yousuf <imran_at_smartitengineering.com>
Date: Mon, 23 Mar 2009 13:48:02 +0600

On Mon, Mar 23, 2009 at 1:43 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
> Oppps i should have looked at the patches more closely, please ignore my
> previous email!
>

No problem at all :), I was a bit confused why you asked me to add
them to the samples issue though :). Waiting for some feedback.

Thank you,

- Imran

> Paul.
>
> On Mar 23, 2009, at 8:31 AM, Imran M Yousuf wrote:
>
>>> <snip />
>>>>>>
>>>>>> Note you can already do the above as follows:
>>>>>>
>>>>>>  FormDataMultiPart multiPart = new FormDataMultiPart().
>>>>>>      field(
>>>>>>          "file",
>>>>>>          new File("src/test/resources/Splash-resized.jpg"),
>>>>>>          MediaType.valueOf("image/jpg")).
>>>>>>      build();
>>>>>>  resource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(multiPart);
>>>>>>
>>>>>> I have just committed the following to the trunk so you can do:
>>>>>>
>>>>>>  FormDataMultiPart multiPart = new FormDataMultiPart().
>>>>>>      field(
>>>>>>
>>>>>>  FormDataContentDisposition.name("file").fileName("userfile").build(),
>>>>>>          new File("src/test/resources/Splash-resized.jpg"),
>>>>>>          MediaType.valueOf("image/jpg")).
>>>>>>      build();
>>>>>>
>>>>>> I might tweak the builder pattern of FormDataContentDisposition
>>>>>> because
>>>>>> it
>>>>>> is possible to convert one of the other builder methods in to a
>>>>>> terminated
>>>>>> builder method, but the principle will remain the same.
>>>>>
>>>>> The only thing that I wanted to avoid is creating disposition
>>>>> manually. So basically what I would like to see is some like -
>>>>>
>>>>> new FileDataBodyPart(String formParamName, java.io.File attachment,
>>>>> MediaType mediaType);
>>>>> new FileDataBodyPart(String formParamName, java.io.File attachment);
>>>>> //Will add media type from file name
>>>>>
>>>>
>>>> OK. Can you please log an issue?
>>>>
>>>
>>> I can log the issue and also contribute to it since it will be fairly
>>> straight forward implementation, I will work on it this weelend and
>>> will submit a patch on Monday, if all goes well.
>>>
>>
>> I have tried working on it and completed the work attached in the
>> patch. Please let me know what you think. I will now create the issues
>> we discussed in the other thread.
>>
>> Thank you,
>>
>> --
>> Imran M Yousuf
>> Entrepreneur & Software Engineer
>> Smart IT Engineering
>> Dhaka, Bangladesh
>> Email: imran_at_smartitengineering.com
>> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
>> Mobile: +880-1711402557
>>
>> <0001-Fix-content-disposition-construction-with-null-name.patch><0002-Add-convenience-form-body-part-extension-for-java.io.patch>---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>



-- 
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran_at_smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557