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