Hi Paul,Imran,
I have modified the code to -
File file = ...
return Response.ok(file, strMimeType).header("Content-Disposition",
"attachment;filename="+strDocName).build();
Following is the log generated -
Apr 1, 2010 4:45:57 PM com.sun.jersey.api.container.filter.LoggingFilter filter
INFO: 1 * Server in-bound request
1 > GET
http://localhost:8076/dsi/rest/repositories/DEVDOC/documents/090004d08000e543/content.xml?username=dmadmin&password=password
1 > accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword, application/x-ms-application,
application/x-ms-xbap, application/vnd.ms-xpsdocument,
application/xaml+xml, */*
1 > accept-language: en-us
1 > ua-cpu: x86
1 > accept-encoding: gzip, deflate
1 > user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;
SV1; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR
3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729)
1 > host: localhost:8076
1 > connection: Keep-Alive
1 >
Apr 1, 2010 4:46:15 PM
com.sun.jersey.api.container.filter.LoggingFilter$Adapter
writeStatusAndHeaders
INFO: 1 * Server out-bound response
1 < 200
1 < Content-Type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
1 < Content-Disposition: attachment; filename=est11
1 <
Apr 1, 2010 4:46:18 PM com.sun.jersey.api.container.filter.LoggingFilter filter
INFO: 2 * Server in-bound request
2 > HEAD
http://localhost:8076/dsi/rest/repositories/DEVDOC/documents/090004d08000e543/content.xml?username=dmadmin&password=password
2 > user-agent: Microsoft Office Existence Discovery
2 > host: localhost:8076
2 > content-length: 0
2 > connection: Keep-Alive
2 >
Apr 1, 2010 4:46:34 PM
com.sun.jersey.api.container.filter.LoggingFilter$Adapter
writeStatusAndHeaders
INFO: 2 * Server out-bound response
2 < 200
2 < Content-Type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
2 < Content-Disposition: attachment; filename=est11
2 < Content-Length: 10489
2 <
TIA,
Emile
On Thu, Apr 1, 2010 at 4:26 PM, Paul Sandoz [via Jersey]
<ml-node+4836351-342976235-462126_at_n2.nabble.com> wrote:
> Hi Emile,
>
> Tip: you can do this instead:
>
> File f = ...
> return Response.ok(f, strMimeType).build();
>
> Try enabling logging on the server side to better see what IE is doing:
>
>
> https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/LoggingFilter.html
>
> It might be IE is doing a HEAD request. JAX-RS by default supports
> HEAD by calling get and ignoring the response entity.
>
> Paul.
>
>
> On Mar 30, 2010, at 5:18 PM, emile wrote:
>
>>
>> Hi,
>>
>> I am using a method with my Resource that downloads file content.
>>
>> @GET
>> public Response getFile()
>> {
>> .....
>> InputStream in = null;
>> in = new BufferedInputStream(new FileInputStream(file));
>> return Response.ok(in, strMimeType).build();
>> }
>>
>> When i send a request to the Resource, I get a file download dialog
>> with
>> Open and Save. When i click the Open button, a new request is sent
>> to the
>> resource and only after that is the file displayed. Not sure why
>> this is
>> happening. Tried the same with StreamingOutput as well but in vain.
>>
>> TIA,
>> Emile
>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/File-Download-Dialog-tp4825099p4825099.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
> ________________________________
> View message @
> http://n2.nabble.com/File-Download-Dialog-tp4825099p4836351.html
> To unsubscribe from File Download Dialog, click here.
>
--
View this message in context: http://n2.nabble.com/File-Download-Dialog-tp4825099p4836424.html
Sent from the Jersey mailing list archive at Nabble.com.