So I solved this problem by emailing using the datastore's mail api instead of javamail. By doing so, you can access the blob as a array of bytes and send that array as an attachment.
On Aug 20, 10:38 am, GKotta <guruko...@gmail.com> wrote: > Hi, > > I am getting a file access denied when I try to send an image in the > datastore as an attachment in an email. Is there any way around this? > I was thinking that there should be some way to use the datastore api > to read the file > but I don't know how to do that. > > This is the part of my code where I attach the image > (result.get(i).getAssociatedImage is the url where it is stored > on the database. In this case, the url is http:\127.0.0.1:8888\image? > title=t609i1) : > > // second part (the image) > messageBodyPart = new MimeBodyPart(); > DataSource fds = new FileDataSource > (result.get(i).getAssociatedImage()); > messageBodyPart.setDataHandler(new > DataHandler(fds)); > messageBodyPart.setHeader("Content- > ID","<image>"); > > // add it > multipart.addBodyPart(messageBodyPart); > > The line "DataSource fds = new FileDataSource > (result.get(i).getAssociatedImage());" is > the problem > > This is the exception that I get: > com.google.gwt.user.server.rpc.UnexpectedException: Service method > 'public abstract boolean com.***.emailAssociatedImages()' threw an > unexpected exception: java.security.AccessControlException: access > denied (java.io.FilePermission http:\127.0.0.1:8888\image?title=t609i1 > read) > > Thanks! -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.