you should not read the images from datastore using HTTP but rather
use the API for that, if you really want first to load a stream from a
HTTP connection and then put its contents into a message, then
consider using URL().open() since GAE does not permit to use fileIO

On 12 Aug., 03:41, GKotta <[email protected]> wrote:
> I have one more question:
>
> I am getting a file access denied when I try to send and image in the
> datastore as an attachment. I there any way around this?
> Code (result.get(i).getAssociatedImage is the url where it is stored
> on the database. In this case, it 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);
> Exception:
> 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!
>
> On Aug 11, 1:35 pm, GKotta <[email protected]> wrote:
>
>
>
> > Thanks everyone!
>
> > On Aug 9, 10:44 pm, Prakash <[email protected]> wrote:
>
> > > @GKotta.
> > > If your use case is to delete images (irrespective of user) after two
> > > months, then cron Or timer job on server (Check Quartz) is the good
> > > way to go. Remember in this approach you wont have access to user
> > > session.
>
> > > If you need User Session to decide whether to delete or not , then you
> > > can use SessionListeners on Server side.
> > > Google for SessionListeners to know more about its use cases.
>
> > > For sending mails , use javax.mail as per @mike's reply.
> > > Hope this helps.
>
> > > Regards,
> > > Prakash M.
>
> > > On Aug 10, 3:09 am, André Moraes <[email protected]> wrote:
>
> > > > Shaffer,
>
> > > > This approach is a little overhead in the maintainability of the code 
> > > > (and
> > > > in the methods too, since every server call will make a extra call to 
> > > > the
> > > > database).
>
> > > > GKotta
>
> > > > To avoid access to images that is in the database but the 2 month time 
> > > > has
> > > > expired, you can make the check only in the methods that access the 
> > > > images
> > > > in the database (if using hibernate this can be an interceptor).
>
> > > > This will introduce overhead, but only when images are needed.
>
> > > > If you cannot add a cron job at your server, create an speciall url that
> > > > requires a custom login/password and when that url is accessed you run 
> > > > the
> > > > code that removes the images from the database. If possible use SSL in 
> > > > this
> > > > part of the site and don't send the username/password in the query 
> > > > string,
> > > > use the HTTP POST METHOD.
>
> > > > Then you can make a cron job in your computer (home or job) and create a
> > > > simple wget script that access that special url. This isn't the best
> > > > solution, but works when you don't have admin access to cron jobs in the
> > > > production server.
>
> > > > --
> > > > André Moraes
> > > > Analista de Desenvolvimento de Sistemas
> > > > [email protected]http://andredevchannel.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to