Interface URLHandler

All Known Subinterfaces:
TimeoutConstrainedURLHandler
All Known Implementing Classes:
AbstractURLHandler, BasicURLHandler, HttpClientHandler, URLHandlerDispatcher

@Deprecated public interface URLHandler
Deprecated.
Starting 2.5.0, the TimeoutConstrainedURLHandler is preferred in favour of this interface
This interface is responsible for handling some URL manipulation (stream opening, downloading, check reachability, ...).

  • Field Details

    • REQUEST_METHOD_GET

      static final int REQUEST_METHOD_GET
      Deprecated.
      Using the slower REQUEST method for getting the basic URL infos. Use this when getting errors behind a problematic/special proxy or firewall chain.
      See Also:
    • REQUEST_METHOD_HEAD

      static final int REQUEST_METHOD_HEAD
      Deprecated.
      Using the faster HEAD method for getting the basic URL infos. Works for most common networks.
      See Also:
    • UNAVAILABLE

      static final URLHandler.URLInfo UNAVAILABLE
      Deprecated.
  • Method Details

    • isReachable

      boolean isReachable(URL url)
      Deprecated.
      Please prefer getURLInfo when several infos are needed.
      Parameters:
      url - the url to check
      Returns:
      true if the target is reachable
    • isReachable

      boolean isReachable(URL url, int timeout)
      Deprecated.
      Please prefer getURLInfo when several infos are needed.
      Parameters:
      url - the url to check
      timeout - the timeout in milliseconds
      Returns:
      true if the target is reachable
    • getContentLength

      long getContentLength(URL url)
      Deprecated.
      Please prefer getURLInfo when several infos are needed.
      Parameters:
      url - the url to check
      Returns:
      the length of the target if the given url is reachable, 0 otherwise. No error code in case of http urls.
    • getContentLength

      long getContentLength(URL url, int timeout)
      Deprecated.
      Parameters:
      url - the url to check
      timeout - the maximum time before considering an url is not reachable a timeout of zero indicates no timeout
      Returns:
      the length of the target if the given url is reachable, 0 otherwise. No error code in case of http urls.
    • getLastModified

      long getLastModified(URL url)
      Deprecated.
      Please prefer getURLInfo when several infos are needed.
      Parameters:
      url - the url to check
      Returns:
      last modified timestamp of the given url
    • getLastModified

      long getLastModified(URL url, int timeout)
      Deprecated.
      Please prefer getURLInfo when several infos are needed.
      Parameters:
      url - the url to check
      timeout - the timeout in milliseconds
      Returns:
      last modified timestamp of the given url
    • getURLInfo

      URLHandler.URLInfo getURLInfo(URL url)
      Deprecated.
      Parameters:
      url - The url from which information is retrieved.
      Returns:
      The URLInfo extracted from the given url, or UNAVAILABLE instance when the url is not reachable.
    • getURLInfo

      URLHandler.URLInfo getURLInfo(URL url, int timeout)
      Deprecated.
      Parameters:
      url - The url from which information is retrieved.
      timeout - The timeout in milliseconds.
      Returns:
      The URLInfo extracted from the given url, or UNAVAILABLE when the url is not reachable, never null.
    • openStream

      InputStream openStream(URL url) throws IOException
      Deprecated.
      Parameters:
      url - ditto
      Returns:
      InputStream
      Throws:
      IOException - if something goes wrong
    • download

      void download(URL src, File dest, CopyProgressListener l) throws IOException
      Deprecated.
      Parameters:
      src - URL
      dest - File
      l - CopyProgressListener
      Throws:
      IOException - if something goes wrong
    • upload

      void upload(File src, URL dest, CopyProgressListener l) throws IOException
      Deprecated.
      Parameters:
      src - File
      dest - URL
      l - CopyProgressListener
      Throws:
      IOException - if something goes wrong
    • setRequestMethod

      void setRequestMethod(int requestMethod)
      Deprecated.