play.libs.WS.FileParam - java examples

Here are the examples of the java api play.libs.WS.FileParam taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

9 View Complete Implementation : NodeBackend.java
Copyright GNU General Public License v3.0
Author : openseedbox
private ITorrent add(File file, String urlOrMagnet) {
    WSRequest req = node.getWebService("/torrents/add");
    // some torrents can take ages to add due to the encryption and having to be allocated
    req.timeout("1min");
    HttpResponse res;
    if (file != null) {
        FileParam fp = new FileParam(file, "torrent");
        req.files(fp);
        res = req.post();
    } else {
        req.setParameter("url", urlOrMagnet);
        res = req.get();
    }
    JsonObject ob = getResponseBodyOrError(res).getAsJsonObject();
    return Util.getGson().fromJson(ob.get("torrent"), NodeTorrent.clreplaced);
}