hi, i got a demo here.
http://hapeblog.appspot.com/blog.shtml?id=2002

On Tue, Mar 2, 2010 at 4:36 AM, Sebastian Cartier <sebi.cart...@gmail.com>wrote:

> Hi
> my first solution i wrote isn't working any more. I had to add
>
> beans = {
>
> multipartResolver(is.hax.spring.web.multipart.StreamingMultipartResolver)
> }
>
> to /grails-app/conf/spring/resources.xml
> Now it works again
>
> @Markus: you can not use byte-arrays with google app engine. You have
> to use blobs! See my previous solution.
> I put the library in <myApplication>/lib
>
> On 2 Feb., 03:08, Markus Paaso <markus.pa...@gmail.com> wrote:
> > Hi
> >
> > I tried it with Grails 1.2.0 and app-engine plugin 0.8.8 but got just
> > an another error:
> >
> > java.lang.NoClassDefFoundError: Could not initialize class
> > org.apache.commons.fileupload.disk.DiskFileItem
> >         at
> org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem
> > (DiskFileItemFactory.java:196)
> >         at org.apache.commons.fileupload.FileUploadBase.parseRequest
> > (FileUploadBase.java:358)
> >         at
> > org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest
> > (ServletFileUpload.java:126)
> >         at
> >
> org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest
> > (CommonsMultipartResolver.java:155)
> >
> > my controller:
> >
> >         def imageInstance = new Image(imageParams)
> >         def f = request.getFile('imageData')
> >         imageInstance.imageData = f.getBytes()
> >         Image.withTransaction {
> >                 if(imageInstance.save(flush:true)) {
> >                     flash.message = "Image ${imageInstance.id} created"
> >                     redirect(action:show,id:imageInstance.id)
> >                 }
> >                 else {
> >
> render(view:'create',model:[imageInstance:imageInstance])
> >                 }
> >         }
> >
> > and domain-class:
> >
> > import javax.persistence.*;
> > // import com.google.appengine.api.datastore.Key;
> >
> > @Entity
> > class Image implements Serializable {
> >
> >     @Id
> >     @GeneratedValue(strategy = GenerationType.IDENTITY)
> >     Long id
> >     byte[] imageData
> >
> >     static constraints = {
> >         id visible:false
> >     }
> >
> > }
> >
> > It seems like the multipart resolver is not replaced with the new one.
> > I placed the jar file into <myApplication>/lib and <GRAILS_HOME>/lib
> > directories.
> > Maybe I didn't place the jar to the right directory?
> > Would you like to tell more about how you got it to work?
> >
> > Markus
> >
> > On 2 helmi, 00:00, Sebastian Cartier <sebi.cart...@gmail.com> wrote:
> >
> > > this works also for grails!
> > > Add the library to your lib directory and add
> > >     <bean id="multipartResolver"
> >
> > > class="is.hax.spring.web.multipart.StreamingMultipartResolver">
> > >     </bean>
> > > to your applicationContext.xml
> >
> > > For saving the image in a google blob i used the following functions:
> > >         @Persistent
> > >         Blob imageBlob
> >
> > >         byte [] getImage(){
> > >                 if(imageBlob){
> > >                         imageBlob.getBytes()
> > >                 }else{
> > >                         null;
> > >                 }
> > >         }
> >
> > >         void setImage(byte [] imageBytes){
> > >                 imageBlob = new Blob(imageBytes)
> > >         }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
dream or truth

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to