Hello, In a nutshell, since GAE cannot write to a filesystem, I have decided to persist my data into the datastore (using JDO). Now, I will like to retrieve the data byte by byte and pass it to the client as an input stream. There's code from the gwtupload library (see below) which breaks on GAE because it writes to the system filesystem. I'll like to be able to provide a GAE ported solution.
public static void copyFromInputStreamToOutputStream(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[100000]; while (true) { synchronized (buffer) { int amountRead = in.read(buffer); if (amountRead == -1) { break; } out.write(buffer, 0, amountRead); } } in.close(); out.flush(); out.close(); } One work around I have tried (didn't work) is to retrieve the data from the datastore as a resource like this: InputStream resourceAsStream = null; PersistenceManager pm = PMF.get().getPersistenceManager(); try { Query q = pm.newQuery(ImageFile.class); lf = q.execute(); resourceAsStream = getServletContext().getResourceAsStream((String) pm.getObjectById(lf)); } finally { pm.close(); } if (lf != null) { response.setContentType(receivedContentTypes.get(fieldName)); copyFromInputStreamToOutputStream(resourceAsStream, response.getOutputStream()); } I welcome your suggestions. Regards -- Odeyemi 'Kayode O. http://www.sinati.com -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.