Class AbstractURLHandler

java.lang.Object
org.apache.ivy.util.url.AbstractURLHandler
All Implemented Interfaces:
URLHandler
Direct Known Subclasses:
BasicURLHandler, HttpClientHandler

public abstract class AbstractURLHandler extends Object implements URLHandler
  • Constructor Details

    • AbstractURLHandler

      public AbstractURLHandler()
  • Method Details

    • isReachable

      public boolean isReachable(URL url)
      Description copied from interface: URLHandler
      Please prefer getURLInfo when several infos are needed.
      Specified by:
      isReachable in interface URLHandler
      Parameters:
      url - the url to check
      Returns:
      true if the target is reachable
    • isReachable

      public boolean isReachable(URL url, int timeout)
      Description copied from interface: URLHandler
      Please prefer getURLInfo when several infos are needed.
      Specified by:
      isReachable in interface URLHandler
      Parameters:
      url - the url to check
      timeout - the timeout in milliseconds
      Returns:
      true if the target is reachable
    • getContentLength

      public long getContentLength(URL url)
      Description copied from interface: URLHandler
      Please prefer getURLInfo when several infos are needed.
      Specified by:
      getContentLength in interface URLHandler
      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

      public long getContentLength(URL url, int timeout)
      Specified by:
      getContentLength in interface URLHandler
      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

      public long getLastModified(URL url)
      Description copied from interface: URLHandler
      Please prefer getURLInfo when several infos are needed.
      Specified by:
      getLastModified in interface URLHandler
      Parameters:
      url - the url to check
      Returns:
      last modified timestamp of the given url
    • getLastModified

      public long getLastModified(URL url, int timeout)
      Description copied from interface: URLHandler
      Please prefer getURLInfo when several infos are needed.
      Specified by:
      getLastModified in interface URLHandler
      Parameters:
      url - the url to check
      timeout - the timeout in milliseconds
      Returns:
      last modified timestamp of the given url
    • getUserAgent

      protected String getUserAgent()
    • validatePutStatusCode

      protected void validatePutStatusCode(URL dest, int statusCode, String statusMessage) throws IOException
      Throws:
      IOException
    • setRequestMethod

      public void setRequestMethod(int requestMethod)
      Specified by:
      setRequestMethod in interface URLHandler
    • getRequestMethod

      public int getRequestMethod()
    • normalizeToString

      protected String normalizeToString(URL url) throws IOException
      Throws:
      IOException
    • normalizeToURL

      protected URL normalizeToURL(URL url) throws IOException
      Throws:
      IOException
    • getDecodingInputStream

      protected InputStream getDecodingInputStream(String encoding, InputStream in) throws IOException
      Throws:
      IOException
    • createTimeoutConstraints

      protected static TimeoutConstraint createTimeoutConstraints(int connectionTimeout)