Weird... Maybe it is the non-capitals in the header name? I'm not sure
whether it shouldn't be rather "Content-Length", instead of
"content-length". Maybe you cold try
response.setContentLength(size)

this is exact copy'n'paste from my code:
--
BlobKey blobKey = new BlobKey(request.getParameter("key"));

BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
response.setContentLength(new Long(blobInfo.getSize()).intValue());
response.setHeader("content-type", blobInfo.getContentType());
response.setHeader("content-disposition", "attachment; filename=" +
blobInfo.getFilename());

blobstoreService.serve(blobKey, response);
--
...both Firebug and Live HTTP headers show the header (with proper value)...

hope it helps

On Sat, May 15, 2010 at 9:00 PM, Guss <[email protected]> wrote:

> one more thing,
> i used httpfox to check the response header, and "content-length"
> header is not sent in the response..
>
> On May 15, 8:28 pm, Jaroslav Záruba <[email protected]> wrote:
> > Hi
> >
> > --
> > BlobInfoFactory blobInfoFactory = new
> > BlobInfoFactory(DatastoreServiceFactory.getDatastoreService());
> > BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
> > long blobSize = blobInfo.getSize();
> > response.setHeader("content-length", new Long(blobSize).toString());
> > --
> >
> > Is this what you mean?
> >
> > Regards
> >   J. Záruba
> >
> >
> >
> >
> >
> > On Sat, May 15, 2010 at 6:38 PM, Guss <[email protected]> wrote:
> > > Hi,
> > > I'm using java in GAE and i recently started using Blobstore to serve
> > > my application download file, the only "issue" that i have is that
> > > when it serves the file
> > > the size is not sent to the browser so it can't estimate the time for
> > > the download to complete...
> >
> > > here is the piece of code that i use to serve the file:
> > >                BlobstoreService blobstoreService =
> > > BlobstoreServiceFactory.getBlobstoreService();
> >
> > >                Iterator<BlobInfo> iterator = new
> > > BlobInfoFactory().queryBlobInfos();
> >
> > >                while(iterator.hasNext()) {
> > >                  BlobInfo b = iterator.next();
> > >                  if (b.getFilename().equals('myfile.exe'))
> > >                          blobstoreService.serve(b.getBlobKey(),resp);
> > >                }
> >
> > > is there a way to also send the file size to the browser while serving
> > > the file?
> >
> > > thanks,
> > > Oded.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine" group.
> > > To post to this group, send email to [email protected]
> .
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib
> [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine?hl=en.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/google-appengine?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to