users@jersey.java.net

[Jersey] Re: How to Upload an image using jersey client

From: Andjarnic <andjarnic_at_yahoo.com>
Date: Mon, 11 Jul 2011 08:34:23 -0700

I am curious if jersey client can be used on android? I use the httpclient library shipped with android to send images and a multipart resource on the server. Jakubs example makes it look much easier than what i did. However i sent an image from a byte[] taken from memory when a photo was snapped.

Sent from my ASUS Eee Pad

Jakub Podlesak <jakub.podlesak_at_oracle.com> wrote:

>Hi Vinod,
>
>it depends on how you want to design the resource on the server side.
>It could look like this:
>
>@Path("image/{id}")
>@PUT @Consumes("image/jpeg")
>public void putImage(@PathParam("id") String imgId, File imgFile) {
> // process the image file here, Jersey will give you a temporary file
>handler in imgFile
>}
>
>The client side could then be like follows:
>
>File imgFile = ...;
>String imgId = ...;
>webResource.path("image").path(imgId).type("image/jpeg").put(imgFile);
>
>~Jakub
>
>On 07/08/2011 11:50 AM, sreepathivinod wrote:
>> Hi all,
>>
>> Thanks in advance,
>>
>> I want to upload an image to server using jersey server. And i want to
>> test(upload an image) through jersey client..
>>
>> Can any one help me plz
>>
>> Thanks
>> Vinod..
>>
>> --
>> View this message in context: http://jersey.576304.n2.nabble.com/How-to-Upload-an-image-using-jersey-client-tp6561930p6561930.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>