Tabnine Logo
HttpDownload.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
ca.nrc.cadc.net.HttpDownload
constructor

Best Java code snippets using ca.nrc.cadc.net.HttpDownload.<init> (Showing top 20 results out of 315)

origin: org.opencadc/cadc-vosi

protected HttpDownload getHttpDownload(final URL url, final ByteArrayOutputStream out)
{
  return new HttpDownload(url, out);
}
origin: org.opencadc/cadc-access-control

/**
 * 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;
}
origin: org.opencadc/cadc-download-manager

private void addDownload(DownloadDescriptor dd) {
  if (downloadDir == null) {
    this.downloadDir = new File(System.getProperty("user.dir"));
  }
  HttpDownload dl = new HttpDownload(userAgent, dd.url, downloadDir);
  dl.setOverwrite(overwrite);
  dl.setDecompress(decompress);
  synchronized (downloads) {
    downloads.add(dl);
  }
}
origin: org.opencadc/cadc-download-manager

public void add(Iterator<DownloadDescriptor> downloads) {
  while (downloads.hasNext()) {
    DownloadDescriptor dd = downloads.next();
    if (DownloadDescriptor.OK.equals(dd.status)) {
      File dest = downloadManager.getDestinationDir();
      if (dd.destination != null) {
        dest = new File(dest, dd.destination);
      }
      HttpDownload dl = new HttpDownload(userAgent, dd.url, dest);
      this.add(dd, dl);
    } else {
      StringBuilder sb = new StringBuilder();
      sb.append("failed to setup download: ");
      if (dd.uri != null) {
        sb.append(dd.uri);
      }
      if (dd.destination != null) {
        sb.append(" -> ");
        sb.append(dd.destination);
      }
      sb.append("\n\treason: ");
      sb.append(dd.error);
      log.error(sb.toString());
    }
  }
}
origin: org.opencadc/cadc-vos

HttpDownload get = new HttpDownload(url, out);
origin: org.opencadc/cadc-uws-server

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);
  }
}
origin: org.opencadc/cadc-test-uws

HttpDownload doit = new HttpDownload(getURL, bos);
if (subject != null) {
  Subject.doAs(subject, new RunnableAction(doit));
origin: org.opencadc/cadc-vosi

get = new HttpDownload(url, dump);
get.setHeadOnly(true);
get.setFollowRedirects(true);
origin: org.opencadc/cadc-vos

HttpDownload get = new HttpDownload(jobURL, out);
origin: org.opencadc/cadc-vos

HttpDownload get = new HttpDownload(jobURL, out);
origin: org.opencadc/cadc-download-manager

log.debug("datalink: " + url);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
HttpDownload get = new HttpDownload(url, bos);
get.run();
if (get.getThrowable() != null) {
origin: org.opencadc/cadc-access-control

HttpDownload download = new HttpDownload(getUserURL, out);
download.run();
origin: org.opencadc/cadc-vos

  download = new HttpDownload(url, localFile);
} else {
  download = new HttpDownload(url, inWrapper);
origin: org.opencadc/cadc-download-manager

HttpDownload get = new HttpDownload(url, bos);
get.run();
    log.debug("resolved URL: " + url + " auth: " + AuthMethod.PASSWORD);
    bos = new ByteArrayOutputStream();
    get = new HttpDownload(url, bos);
    get.run();
    if (get.getThrowable() == null) {
origin: org.opencadc/cadc-access-control

HttpDownload transfer = new HttpDownload(getGroupURL, out);
transfer.setSSLSocketFactory(getSSLSocketFactory());
transfer.run();
origin: org.opencadc/cadc-test-uws

log.info(jobName + " wait " + blockURL);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
HttpDownload get = new HttpDownload(blockURL, bos);
if (subject != null) {
  Subject.doAs(subject, new RunnableAction(get));
origin: org.opencadc/cadc-access-control

new HttpDownload(getGroupNamesURL, new InputStreamWrapper()
origin: org.opencadc/cadc-access-control

HttpDownload get = new HttpDownload(getUserURL, out);
origin: org.opencadc/cadc-access-control

final List<User> webUsers = new ArrayList<User>();
HttpDownload httpDownload =
    new HttpDownload(usersURL,
             new JsonUserListInputStreamWrapper(webUsers));
httpDownload.setRequestProperty("Accept", "application/json");
origin: org.opencadc/cadc-cdp

HttpDownload get = new HttpDownload(location, bos);
ca.nrc.cadc.netHttpDownload<init>

Javadoc

Constructor. If the user agent string is not supplied, a default value will be generated.

The src URL cannot be null. If the protocol is https, this class will get the current Subject from the AccessControlContext and use the Certificate(s) and PrivateKey(s) found there to set up an SSLSocketFactory. This is required if ther server requests that the client authenticate itself.

The dest File cannot be null. If dest is a directory, the downloaded file will be saved in that directory and the filename will be determined from the HTTP headers or URL. If dest is an existing file or it does not exist but it's parent is a directory, dest will be used directly.

Popular methods of HttpDownload

  • getThrowable
  • run
    Run the download. This method is intended to be run via a Thread (or pool) but can be called directl
  • getContentType
    Get the content-type returned by the server.
  • getResponseCode
  • getContentLength
    Get the size of the download (the Content-Length).
  • setMaxRetries
  • setOverwrite
    Enable forced overwrite of existing destiantion file.
  • setTransferListener
  • setUserAgent
  • askOverwrite
  • checkStatusCode
  • checkTransient
  • checkStatusCode,
  • checkTransient,
  • doCheckDestination,
  • doDecompress,
  • doGet,
  • findEventID,
  • fireEvent,
  • getContentEncoding,
  • getFile

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now