How to download images in playframework jobs?

Posted by MrROY on Stack Overflow See other posts from Stack Overflow or by MrROY
Published on 2012-03-18T17:59:35Z Indexed on 2012/03/18 18:02 UTC
Read the original article Hit count: 457

I have a playframework Job class like this:

public class ImageDownloader extends Job {
 private String[] urls;
 private String dir;

 public ImageDownloader(){}
 public ImageDownloader(String[] urls,String dir){
   this.urls = urls;
   this.dir = dir;
 }

 @Override
 public void doJob() throws Exception {
   if(urls!=null && urls.length > 0){
     for (int i = 0; i < urls.length; i++) {
       String url = urls[i];
       //Dowloading
     }
   }
 }
}

Play(1.2.4) has lots of amazing tools to make things easy.

So i wonder whether there's a way to make the downloading easy and beautiful in play ?

© Stack Overflow or respective owner

Related posts about java

Related posts about asynchronous