Class ApacheURLLister


  • public class ApacheURLLister
    extends java.lang.Object
    Utility class which helps to list urls under a given url. This has been tested with Apache 1.3.33 server listing, as the one used at ibiblio, and with Apache 2.0.53 server listing, as the one on mirrors.sunsite.dk.
    • Constructor Summary

      Constructors 
      Constructor Description
      ApacheURLLister()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.net.URL> listAll​(java.net.URL url)
      Returns a list of sub urls of the given url.
      java.util.List<java.net.URL> listDirectories​(java.net.URL url)
      Returns a list of sub 'directories' of the given url.
      java.util.List<java.net.URL> listFiles​(java.net.URL url)
      Returns a list of sub 'files' (in opposition to directories) of the given url.
      java.util.List<java.net.URL> retrieveListing​(java.net.URL url, boolean includeFiles, boolean includeDirectories)
      Retrieves a List of URLs corresponding to the files and/or directories found at the supplied base URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApacheURLLister

        public ApacheURLLister()
    • Method Detail

      • listAll

        public java.util.List<java.net.URL> listAll​(java.net.URL url)
                                             throws java.io.IOException
        Returns a list of sub urls of the given url. The returned list is a list of URL.
        Parameters:
        url - The base URL from which to retrieve the listing.
        Returns:
        a list of sub urls of the given url.
        Throws:
        java.io.IOException - If an error occurs retrieving the HTML.
      • listDirectories

        public java.util.List<java.net.URL> listDirectories​(java.net.URL url)
                                                     throws java.io.IOException
        Returns a list of sub 'directories' of the given url. The returned list is a list of URL.
        Parameters:
        url - The base URL from which to retrieve the listing.
        Returns:
        a list of sub 'directories' of the given url.
        Throws:
        java.io.IOException - If an error occurs retrieving the HTML.
      • listFiles

        public java.util.List<java.net.URL> listFiles​(java.net.URL url)
                                               throws java.io.IOException
        Returns a list of sub 'files' (in opposition to directories) of the given url. The returned list is a list of URL.
        Parameters:
        url - The base URL from which to retrieve the listing.
        Returns:
        a list of sub 'files' of the given url.
        Throws:
        java.io.IOException - If an error occurs retrieving the HTML.
      • retrieveListing

        public java.util.List<java.net.URL> retrieveListing​(java.net.URL url,
                                                            boolean includeFiles,
                                                            boolean includeDirectories)
                                                     throws java.io.IOException
        Retrieves a List of URLs corresponding to the files and/or directories found at the supplied base URL.
        Parameters:
        url - The base URL from which to retrieve the listing.
        includeFiles - If true include files in the returned list.
        includeDirectories - If true include directories in the returned list.
        Returns:
        A List of URLs.
        Throws:
        java.io.IOException - If an error occurs retrieving the HTML.