Paul Sandoz wrote:
> HI Naresh, Imran,
>
> The media type "application/x-www-form-urlencoded" is the wrong media
> type to use for uploading files.
My apologies...
I thought it works with "application/x-www-form-urlencoded" too.
Thanks for correcting me Paul.
-Naresh
>
> The media type "application/form-data" needs to be used.
>
> See the following email for an attachment that contains a simple maven
> project using forms:
>
>
> http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+form-data#query:list%3Anet.java.dev.jersey.users%20form-data%20order%3Adate-backward+page:1+mid:qbkax55u7crqu7wi+state:results
>
>
> I think we need a good sample showing the use of various forms. Hint
> hint to any one who wants to contribute one :-)
>
>
>
> Note that i am in the process of fixing a number of bugs and improving
> form-data processing. I will deprecate the use of @FormParam with
> "multipart/form-data". Instead developers will be encouraged to use
> @FormDataParam which will not overload the semantics of @FormParam and
> will i think cause less confusion, and plus is a place i can clear
> document behavior for multipart/form-data support.
>
> Paul.
>
> On Mar 19, 2009, at 10:23 AM, Naresh wrote:
>
>> Imran M Yousuf wrote:
>>> On Thu, Mar 19, 2009 at 12:17 PM, Naresh <bsnaresh_at_sun.com> wrote:
>>>
>>>> Hi Imran,
>>>>
>>>> please check the [simple-servlet] sample. It has the code sample for
>>>> submitting a form.
>>>>
>>>> [simple-servlet]
>>>> http://download.java.net/maven/2/com/sun/jersey/samples/simple-servlet/1.0.3-SNAPSHOT/simple-servlet-1.0.3-SNAPSHOT-project.zip
>>>>
>>>>
>>>
>>> Thanks. Any idea how I could add an attachment to the Form?
>>>
>> You can use the HTML file control for uploading files, and @FormParam
>> annotation for accessing the file.
>> The following is a sample code:
>>
>> @POST
>> @Path("form")
>> @Produces("text/plain")
>> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
>> public String getFileContents(@FormParam ("inputfile") InputStream
>> fileStream) {
>> ....
>> }
>>
>> HTH,
>> Naresh
>>>
>>>> Thanks,
>>>> Naresh
>>>>
>>>> Imran M Yousuf wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Can someone please help me find code sample for submitting a form
>>>>> (preferably includes a file attachment) using Jersey Client API?
>>>>>
>>>>> Thank you,
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>