users@jersey.java.net

Re: [Jersey] Uploading files using Jersey client

From: Imran M Yousuf <imran_at_smartitengineering.com>
Date: Fri, 20 Mar 2009 16:02:34 +0600

On Fri, Mar 20, 2009 at 3:40 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On Mar 20, 2009, at 5:52 AM, Imran M Yousuf wrote:
>
>> On Fri, Mar 20, 2009 at 10:12 AM, Imran M Yousuf
>> <imran_at_smartitengineering.com> wrote:
>>>
>>>  <snip />
>>>   @POST
>>>   @Path("test")
>>>   @Consumes({MediaType.MULTIPART_FORM_DATA,
>>>                 MediaType.APPLICATION_FORM_URLENCODED
>>>             })
>>>   public Response testMultipartForm(
>>>       @FormParam("myFile") final InputStream fileStream,
>>>       @FormParam("myFile") final FormDataContentDisposition disposition,
>>>       @FormParam("text") final String simpleText,
>>>       @FormParam("integer") final Integer simpleInt,
>>>       @DefaultValue(value = "false") @FormParam("bool") final
>>> Boolean simpleBoolean) {
>>
>> Another question that I have is - Why does not the @DefaultValue work
>> here? If the form does not have the param "bool" it is a NULL, IMHO,
>> it should respect default value if mentioned.
>>
>
> It is a bug, although i thought i did implement this, my memory is hazy :-)
>

Since you are currently working on it I will not log an issue in this regard :).

> The above also reflects a design error on my part.  We should not allow a
> method to support both MULTIPART_FORM_DATA and APPLICATION_FORM_URLENCODED
> using @FormParam as the formats are distinct, the latter being
> character-based, the former being octet-based, which makes for subtleties
> when decoding. For example FormDataContentDisposition will not exist for
> latter.
>
> Thus i am going to deprecate such behavior.
>

I agree, thanks a lot.

- Imran

> Paul.
>
> ---------------------------------------------------------------------
> 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