You should be able to get InputStream (File in java is used for
different purposes and AFAIK it can't exist without alignment to
filesystem).. simply try
ClientResponse cr = ....
InputStream is = cr.getEntity(InputStream.class);
You can do whatever you like with that afterwards, for example save it
as a file..
Pavel
On 6/24/11 10:36 PM, Jitesh Sinha -X (jisinha - Siliconweb Inc. at
Cisco) wrote:
> That worked! Thanks.
>
> Now I am having another issue. I need to get a file that is being sent
> from server side as an attachment.I am using Jersey client on client
> side.
>
> Here is the server side code -
>
> String fileToDownload = "Result.zip";
> response.setContentType("application/octet-stream");
> response.setHeader("Content-Disposition", "attachment;
> filename=\""
> + fileToDownload + "\"");
> ServletOutputStream sos = null;
> try {
> sos = response.getOutputStream();
> } catch (IOException ioex) {
> System.out.println("streamForDownload:::::::" +
> ioex);
> }
>
>
>
> How can I get the file from ClientResponse object on client side?
>
> Thanks
> -Jitesh
>
> -----Original Message-----
> From: Pavel Bucek [mailto:pavel.bucek_at_oracle.com]
> Sent: Thursday, June 23, 2011 12:13 AM
> To: users_at_jersey.java.net
> Subject: [Jersey] Re: How to post a file and other form fields by Jersey
> client
>
> yes, that will work.
>
> On 6/23/11 3:29 AM, Jitesh wrote:
>> Do I put it into response entity on server side like this -
>>
>> Response.ok(String.valueOf(Id)).build() ;
>>
>> where Response is javax.ws.rs.core.Response .
>>
>> and then I get it as you have mentioned in your post?
>>
>> Thanks
>> -Jitesh
>>
>> --
>> View this message in context:
> http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fie
> lds-by-Jersey-client-tp6502947p6506822.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>