/** * Used for tests to override. * * @param url The URL to download from. * @param outputStream The OutputStream to write to. * @return HttpDownload instance used. * @throws IOException Any errors. */ protected HttpDownload download(final URL url, final OutputStream outputStream) throws IOException { final HttpDownload get = new HttpDownload(url, outputStream); get.run(); return get; }
HttpDownload get = new HttpDownload(url, out); get.run();
public ExecutionPhase getPhase(String jobID) throws JobNotFoundException, JobPersistenceException { try { URL u = new URL(baseURL.toExternalForm() + "/" + jobID); ByteArrayOutputStream out = new ByteArrayOutputStream(); HttpDownload get = new HttpDownload(u, out); get.setUserAgent(this.getClass().getName()); get.run(); if (get.getThrowable() != null) { if (get.getThrowable().getMessage().contains("not found")) throw new JobNotFoundException("not found: " + jobID); throw new JobPersistenceException("failed to get " + jobID, get.getThrowable()); } String phase = out.toString().trim(); log.debug("phase: " + phase); ExecutionPhase ret = ExecutionPhase.toValue(phase); return ret; } catch(MalformedURLException bug) { throw new RuntimeException("BUG - failed to create valid URL", bug); } }
Subject.doAs(subject, new RunnableAction(doit)); } else { doit.run();
get.setHeadOnly(true); get.setFollowRedirects(true); get.run();
currentTask.run(); } else { log.debug(workerBasename + "no longer part of pool");
ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpDownload get = new HttpDownload(url, bos); get.run(); if (get.getThrowable() != null) { return new FailIterator(uri, "failed to resolve URI: " + get.getThrowable().getMessage());
ByteArrayOutputStream out = new ByteArrayOutputStream(); HttpDownload download = new HttpDownload(getUserURL, out); download.run();
httpDownload.run();
HttpDownload transfer = new HttpDownload(getGroupURL, out); transfer.setSSLSocketFactory(getSSLSocketFactory()); transfer.run();
Subject.doAs(subject, new RunnableAction(get)); } else { get.run();
httpDownload.run();
HttpDownload get = new HttpDownload(getUserURL, out); get.run(); int responseCode = get.getResponseCode();
HttpDownload get = new HttpDownload(redirectURL, out); get.run();
transfer.run();
HttpDownload transfer = new HttpDownload(getMembershipURL, out); transfer.setSSLSocketFactory(getSSLSocketFactory()); transfer.run();
new JsonUserListInputStreamWrapper(webUsers)); httpDownload.setRequestProperty("Accept", "application/json"); httpDownload.run();
HttpDownload get = new HttpDownload(location, bos); get.run(); if ( get.getThrowable() != null)