congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
HttpDownload.setUserAgent
Code IndexAdd Tabnine to your IDE (free)

How to use
setUserAgent
method
in
ca.nrc.cadc.net.HttpDownload

Best Java code snippets using ca.nrc.cadc.net.HttpDownload.setUserAgent (Showing top 4 results out of 315)

origin: org.opencadc/cadc-util

public HttpDownload(String userAgent, URL src, InputStreamWrapper dest)
{
  super(true);
  setUserAgent(userAgent);
  if (src == null)
    throw new IllegalArgumentException("source URL cannot be null");
  if (dest == null)
    throw new IllegalArgumentException("destination wrapper cannot be null");
  this.remoteURL = src;
  this.wrapper = dest;
}
origin: org.opencadc/cadc-util

/**
 * Constructor. If the user agent string is not supplied, a default value will be generated.
 * <p>
 * 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.
 * </p>
 * <p>
 * The dest output stream cannot be null.
 * </p>
 * 
 * @param userAgent user-agent string to report in HTTP headers
 * @param src URL to read
 * @param dest output stream to write to
 */
public  HttpDownload(String userAgent, URL src, OutputStream dest)
{
  super(true);
  setUserAgent(userAgent);
  if (src == null)
    throw new IllegalArgumentException("source URL cannot be null");
  if (dest == null)
    throw new IllegalArgumentException("destination stream cannot be null");
  this.remoteURL = src;
  this.destStream = dest;
}
origin: org.opencadc/cadc-util

setUserAgent(userAgent);
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);
  }
}
ca.nrc.cadc.netHttpDownloadsetUserAgent

Popular methods of HttpDownload

  • <init>
    Constructor with default user-agent string.
  • 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
  • askOverwrite
  • checkStatusCode
  • checkTransient
  • checkStatusCode,
  • checkTransient,
  • doCheckDestination,
  • doDecompress,
  • doGet,
  • findEventID,
  • fireEvent,
  • getContentEncoding,
  • getFile

Popular in Java

  • Making http requests using okhttp
  • getSystemService (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Path (java.nio.file)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JCheckBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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