Why don't you just redirect them to the file and let the hosting server serve it directly? i.e. self.redirect(urlStr)
Phil On 6 April 2011 14:47, fstof <[email protected]> wrote: > Hi, > I'm looking for a way that I can open a URLConnection to a file on the > internet and serve it directly to the browser. > > something like this (normal servlet) > String urlStr = req.getParameter("dl"); > URL url = new URL(urlStr); > URLConnection con = url.openConnection(); > InputStream is = con.getInputStream(); > resp.setContentType(con.getContentType()); > resp.setHeader("Content-Disposition", "attachment; > filename=" + > url.getFile()); > OutputStream os = resp.getOutputStream(); > > byte[] buff = new byte[1024]; > while (is.read(buff) != -1) { > os.write(buff); > } > os.flush(); > os.close(); > > Now this works fine for smaller files, but the moment the files are > larger than 1Mb GAE blocks the Connection to the remote file. > > now I was thinking of rather than streaming directly to the browser > client. would it be possible to download the file to the GAE > BlobStore? > > Any thoughts > > -- > 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. > > -- 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.
