Works for me:
http://jzaruba-1.appspot.com/blob?key=AMIfv97ojheagz9LYcvrv86ROmXLdu4Bx3gP5sK1xd6K1tE_b7X1nbtxRNBQz814fGuiyaJWsrnI-jywxD-Wjaytq75B1D3663aU7nk8ECG0e8JH_aJO45DHtF9dNKlQfvZLvpgN-U78bsE80T55Z1-roUy8AYdQdA
Are you sure you send actual number in your header?

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

> the code is working on the development environment, but not after i
> deploy it to gae
>
> On May 16, 12:17 am, Guss <[email protected]> wrote:
> > hmmm
> > not working..
> > i don't know why..
> >
> > i run this code:
> >         public void doGet(HttpServletRequest req, HttpServletResponse
> resp)
> >                         throws IOException {
> >
> >                 BlobstoreService blobstoreService =
> > BlobstoreServiceFactory.getBlobstoreService();
> >
> >                 Iterator<BlobInfo> iterator = new
> > BlobInfoFactory().queryBlobInfos();
> >
> >                 while(iterator.hasNext()) {
> >                   BlobInfo b = iterator.next();
> >                   if (b.getFilename().equals("myfile.exe")) {
> >                           resp.setHeader("content-type",
> b.getContentType());
> >                           resp.setHeader("content-disposition",
> "attachment; filename=" +
> > b.getFilename());
> >                           resp.setHeader("content-length", new
> > Long(b.getSize()).toString());
> >                           resp.setContentLength(new
> Long(b.getSize()).intValue());
> >                           blobstoreService.serve(b.getBlobKey(),resp);
> >                   }
> >                 }
> >         }
> >
> > and got this response header (using firebug)
> > HTTP/1.1 200 OK
> > Content-Type: application/x-msdownload
> > Content-Disposition: attachment; filename=myfile.exe
> > Date: Sat, 15 May 2010 21:14:16 GMT
> > Server: Google Frontend
> > Transfer-Encoding: chunked
> >
> > On May 15, 10:49 pm, Jaroslav Záruba <[email protected]>
> > wrote:
> >
> >
> >
> >
> >
> > > 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]><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]><google-appengine%2Bunsubscrib
> [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]><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 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