Hi, I'm working on Grails web application and need to upload files. I have a form (simplified here):
<g:form action="save" method="post" enctype="multipart/form-data">
<input type="file" id="image" name="image" />
<input class="save" type="submit" value="Create" />
</g:form>
and in Controller code (I know that this should not be in controller but this is just to make it work and than will be designed better):
def save = {
GaeVFS.setRootPath( servletContext.getRealPath( "/" ) );
FileSystemManager fsManager = GaeVFS.getManager();
FileObject tmpFolder = fsManager.resolveFile( "gae://WEB-INF/upload_files" );
if ( !tmpFolder.exists() ) {
tmpFolder.createFolder();
}
//I NEED CODE HERE TO SAVE THE IMAGE IN THE BIGTABLE VIA GAEVFS
}
So I have two problems:
A. When save create button is pressed a get exception since it tries to use Apache Commons FileUpload that tries to save to file system.
How do I disable it?
Exception is: java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) at org.apache.commons.fileupload.disk.DiskFileItem.(DiskFileItem.java:103) at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
B. I need the code example to save image via gaevfs I have seen example in GaeVfsServlet but I still don't know how exactly it should look in my case. Any kind of help is welcome.
GaeVfsServlet url: http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/servlet/GaeVfsServlet.java