On Friday, 16 January, 2015 05:51 PM, Thierry Boileau wrote:
> Hello,
> I guess you are refering to this page of the user guide:
> http://restlet.com/technical-resources/restlet-framework/guide/2.3/extensions/fileupload
> The code is exactly the same for the GAE edition, except that you cannot 
> write File directly as is it forbidden by the GAE platform.
> You can still have access to the FileItem#getInputStream() method.
> Best regards,
> Thierry Boileau
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3094350


I am not sure but it seems the sample you gave throws error and we 
cannot use the repackaged apache package with Restlet.

So I improvised, I manage to upload large files with Restlet and GAE 
with this code:

     public void upload(Representation entity) throws Exception {
         if (entity != null) {
(MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) {
                 Request restletRequest = getRequest();
                 HttpServletRequest servletRequest = 
                 ServletFileUpload upload = new ServletFileUpload();
                 FileItemIterator fileIterator = 
                 while (fileIterator.hasNext()) {
                     FileItemStream item = fileIterator.next();
                     String name = item.getName();
                     byte[] content = 
                    // do stuff with content    
             } else {
         } else {

Perhaps you can share this with Restlet documentation so community would 
benefit to this code. Or perhaps you can see some issues with the code.


Reply via email to