Submits a new hadoop image download task.

@param URL
The url of the image
@param id
The id of the image (used to name the image file after download)
545135
public void submitHadoopDownloadTask(String URL, String id) {
        Callable<ImageDownloadResult> call = new HadoopImageDownload(URL, id, followRedirects);
        pool.submit(call);
        numPendingTasks++;
    }
680675
public ExtViewQuery image(String url, Callback callback) {
        if (!TextUtils.isEmpty(url) && view instanceof ImageView) {
            Picasso.with(context).load(url).into((ImageView) view, callback);
        }
        return self();
    }
412064
public void downloadFile(int fileId, java.io.File target, FileSize size)
			throws IOException {
		WebResource builder = getResourceFactory()
				.getFileResource("/" + fileId);
		if (size != null) {
			builder = builder.path("/" + size.name().toLowerCase());
		}
		byte[] data = builder.get(byte[].class);
		FileUtils.writeByteArrayToFile(target, data);
	}
1064871
@Override
    public void download(String fileName, byte[] data) {
        assertArgumentNotNull("fileName", fileName);
        assertArgumentNotNull("data", data);
        final ResponseDownloadResource resource = createResponseDownloadResource(fileName);
        resource.data(data);
        doDownload(resource);
    }
76546
public static void writeHtmlImagePreloadJavaScript(String url, Appendable out) throws IOException {
		out.append("<script type='text/javascript'>\n"
				+ "  var img=new Image();\n"
				+ "  img.src=\"");
		// Escape for javascript
		StringBuilder javascript = new StringBuilder(url.length());
		encodeTextInJavaScript(url, javascript);
		// Encode for XML attribute
		encodeJavaScriptInXhtmlAttribute(javascript, out);
		out.append("\";\n"
				+ "</script>");
	}
918104
function _cmdDownloadFile(downloadId, url, proxy, callback, pCallback) {
    // Backwards compatibility check, added in 0.37
    if (typeof proxy === "function") {
        callback = proxy;
        proxy = undefined;
    }

    if (pendingDownloads[downloadId]) {
        callback(Errors.DOWNLOAD_ID_IN_USE, null);
        return;
    }

    var req = request.get({
        url: url,
        encoding: null,
        proxy: proxy
    },
        // Note: we could use the traditional "response"/"data"/"end" events too if we wanted to stream data
        // incrementally, limit download size, etc. - but the simple callback is good enough for our needs.
        function (error, response, body) {
            if (error) {
                // Usually means we never got a response - server is down, no DNS entry, etc.
                _endDownload(downloadId, Errors.NO_SERVER_RESPONSE);
                return;
            }
            if (response.statusCode !== 200) {
                _endDownload(downloadId, [Errors.BAD_HTTP_STATUS, response.statusCode]);
                return;
            }

            var stream = temp.createWriteStream("brackets");
            if (!stream) {
                _endDownload(downloadId, Errors.CANNOT_WRITE_TEMP);
                return;
            }
            pendingDownloads[downloadId].localPath = stream.path;
            pendingDownloads[downloadId].outStream = stream;

            stream.write(body);
            _endDownload(downloadId);
        });

    pendingDownloads[downloadId] = { request: req, callback: callback };
}
1134248
private void downloadFile(File downloadFile, String url) throws IOException {
        if (!downloadFile.exists()) {
            int max = 3;
            for (int trial = 0; trial < max; trial++) {
                try {
                    downloader.downloadFile(url, downloadFile.getAbsolutePath());
                    return;
                } catch (SocketTimeoutException ex) {
                    if (trial >= max - 1)
                        throw new RuntimeException(ex);
                    try {
                        Thread.sleep(sleep);
                    } catch (InterruptedException ignored) {
                    }
                }
            }
        }
    }
1097163
public void sendJsonToUrl(Object data, String url) {
        sendToUrl(JSON.toJSONString(data), url);
    }
607051
@WebOperationMethod
    public Map<String,Object> downloadAsFile(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws Exception {
        String database = Objects.get(params, "database");
        String collection = Objects.get(params, "collection", COLLECTION);
        String id = Objects.get(params, "id");
        String name = Objects.get(params, "name");

        FileStorage.FileReadBean b = null;
        try{
            b = FileStorage.read(new Id(database,collection,id));
            response.setContentType(b.getMeta().getContentType());
            if (Objects.isNullOrEmpty(name)) {
                name = b.getMeta().getName();
                if (name.length() > 100)
                    name = name.substring(0, 100);
                if (!Objects.isNullOrEmpty(b.getMeta().getExt()))
                    name += "." + b.getMeta().getExt();
            }
            response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(name, "UTF-8"));
            try {
                IOUtils.copy(b.getInputStream(), response.getOutputStream());
            } catch (IOException e) {
                throw S1SystemError.wrap(e);
            }
        }catch (NotFoundException e) {
            response.setStatus(404);
        }finally {
            FileStorage.closeAfterRead(b);
        }
        return null;
    }
673520
public void sendRedirect(String url) 
        throws IOException
    {
        if (url==null)
            throw new IllegalArgumentException();
        
        if (!URI.hasScheme(url))
        {
            StringBuffer buf = _servletHttpRequest.getHttpRequest().getRootURL();
            if (url.startsWith("/"))
                buf.append(URI.canonicalPath(url));
            else
            {
                String path=_servletHttpRequest.getRequestURI();
                String parent=(path.endsWith("/"))?path:URI.parentPath(path);
                url=URI.canonicalPath(URI.addPaths(parent,url));
                if (!url.startsWith("/"))
                    buf.append('/');
                buf.append(url);
            }
            
            url=buf.toString();
        }
        
        resetBuffer();
        
        _httpResponse.setField(HttpFields.__Location,url);
        _httpResponse.setStatus(HttpResponse.__302_Moved_Temporarily);
        complete();
    }
426934
public void addId(final URI id, final String value) {
        if (id != null && value != null) {
            final URI localId = id.normalize();
            final String localValue = value.trim();
            idMap.put(localId, localValue);
        }
    }
837785
protected void addURL(final URL url) {
    final URL[] newUrls = new URL[this.urls.length + 1];
    System.arraycopy(url, 0, newUrls, 0, this.urls.length);
    newUrls[this.urls.length] = url;
    this.urls = newUrls;
  }
672205
public void setHtmlElementId(String id) {
		htmlElementId = id;
		mapWidget.setHtmlElement(DOM.getElementById(id));
		mapWidget.draw();
	}
763561
public synchronized void onServerReconnected(final String id, final String uri) {
        logger.debug("[onServerReconnected] id = {}, uri = {}", id, uri);

        if (id.length() == 0) {
            Server server = getServerByUri(uri);
            server.register();
            server.setAvailable(true);
        }

        refreshServers();
    }
1107984
public static BufferedImage loadImage(URL url) {
		if( url == null )
			return null;
		try {
			BufferedImage buffered = ImageIO.read(url);
			if( buffered != null )
				return buffered;
			if( url.getProtocol().equals("file")) {
				String path = URLDecoder.decode(url.getPath(), "UTF-8");
				if( !new File(path).exists() ) {
					System.err.println("File does not exist: "+path);
					return null;
				}
			}
		} catch (IOException ignore) {}
		try {
			InputStream stream = url.openStream();
			String path = url.toString();
			if( path.toLowerCase().endsWith("ppm")) {
				return loadPPM(stream,null);
			} else if( path.toLowerCase().endsWith("pgm") ) {
				return loadPGM(stream, null);
			}
			stream.close();
		} catch (IOException ignore) {}

		return null;
	}
1211536
public static boolean download(String storageFolder, String downloadURL) {
        Downloader.storageFolder = storageFolder;
        return download(downloadURL);
    }
215129
function downloadImage(map) {
    map.exportAsImage(function (url) {
        let a = document.createElement("a");
        a.download = "example";
        a.href = url;
        a.click();
    }, "jpeg");
}