users@jersey.java.net

Re: [Jersey] File Download Dialog

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 01 Apr 2010 12:54:38 +0200

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: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>