com.opensymphony.xwork2.util.finder

## Class UrlSet

- java.lang.Object
- - com.opensymphony.xwork2.util.finder.UrlSet

-     public class UrlSet
      extends Object

  Use with ClassFinder to filter the Urls to be scanned, example:

       UrlSet urlSet = new UrlSet(classLoader);
       urlSet = urlSet.exclude(ClassLoader.getSystemClassLoader().getParent());
       urlSet = urlSet.excludeJavaExtDirs();
       urlSet = urlSet.excludeJavaEndorsedDirs();
       urlSet = urlSet.excludeJavaHome();
       urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
       urlSet = urlSet.exclude(".*?/JavaVM.framework/.*");
       urlSet = urlSet.exclude(".*?/activemq-(core|ra)-[\\d.]+.jar(!/)?");

  Author:
    David Blevins

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `UrlSet.FileProtocolNormalizer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlSet(ClassLoaderInterface classLoader)`
    `UrlSet(ClassLoaderInterface classLoader, Set<String> protocols)`
    `UrlSet(Collection<URL> urls)` Ignores all URLs that are not "jar" or "file"
    `UrlSet(URL... urls)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UrlSet` | `exclude(ClassLoaderInterface parent)`
    `UrlSet` | `exclude(File file)`
    `UrlSet` | `exclude(String pattern)`
    `UrlSet` | `exclude(UrlSet urlSet)`
    `UrlSet` | `excludeJavaEndorsedDirs()` Calls excludePaths(System.getProperty("java.endorsed.dirs"))
    `UrlSet` | `excludeJavaExtDirs()` Calls excludePaths(System.getProperty("java.ext.dirs"))
    `UrlSet` | `excludeJavaHome()`
    `UrlSet` | `excludePaths(String pathString)`
    `UrlSet` | `excludeUserExtensionsDir()` Calls excludePaths(System.getProperty("java.ext.dirs"))
    `List<URL>` | `getUrls()`
    `UrlSet` | `include(UrlSet urlSet)`
    `UrlSet` | `includeClassesUrl(ClassLoaderInterface classLoaderInterface, UrlSet.FileProtocolNormalizer normalizer)` Try to find a classes directory inside a war file add its normalized url to this set
    `UrlSet` | `matching(String pattern)`
    `UrlSet` | `relative(File file)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UrlSet

          public UrlSet(ClassLoaderInterface classLoader)
                 throws IOException

      Throws:
        `IOException`

    - #### UrlSet

          public UrlSet(ClassLoaderInterface classLoader,
                        Set<String> protocols)
                 throws IOException

      Throws:
        `IOException`

    - #### UrlSet

          public UrlSet(URL... urls)

    - #### UrlSet

          public UrlSet(Collection<URL> urls)

      Ignores all URLs that are not "jar" or "file"
      Parameters:
        `urls` - collection of URLs

  - ### Method Detail

    - #### include

          public UrlSet include(UrlSet urlSet)

    - #### exclude

          public UrlSet exclude(UrlSet urlSet)

    - #### exclude

          public UrlSet exclude(ClassLoaderInterface parent)
                         throws IOException

      Throws:
        `IOException`

    - #### exclude

          public UrlSet exclude(File file)
                         throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### exclude

          public UrlSet exclude(String pattern)
                         throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### excludeJavaExtDirs

          public UrlSet excludeJavaExtDirs()
                                    throws MalformedURLException

      Calls excludePaths(System.getProperty("java.ext.dirs"))
      Returns:
        url set
      Throws:
        `MalformedURLException` - in case if incorrect URL

    - #### excludeJavaEndorsedDirs

          public UrlSet excludeJavaEndorsedDirs()
                                         throws MalformedURLException

      Calls excludePaths(System.getProperty("java.endorsed.dirs"))
      Returns:
        url set
      Throws:
        `MalformedURLException` - in case if incorrect URL

    - #### excludeUserExtensionsDir

          public UrlSet excludeUserExtensionsDir()
                                          throws MalformedURLException

      Calls excludePaths(System.getProperty("java.ext.dirs"))
      Returns:
        url set
      Throws:
        `MalformedURLException` - in case if incorrect URL

    - #### excludeJavaHome

          public UrlSet excludeJavaHome()
                                 throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### excludePaths

          public UrlSet excludePaths(String pathString)
                              throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### matching

          public UrlSet matching(String pattern)

    - #### includeClassesUrl

          public UrlSet includeClassesUrl(ClassLoaderInterface classLoaderInterface,
                                          UrlSet.FileProtocolNormalizer normalizer)
                                   throws IOException

      Try to find a classes directory inside a war file add its normalized url to this set
      Parameters:
        `classLoaderInterface` - class loader interface
        `normalizer` - file protocol normalizer
      Returns:
        url set
      Throws:
        `IOException` - in case of IO errors

    - #### relative

          public UrlSet relative(File file)
                          throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### getUrls

          public List<URL> getUrls()

Copyright © 2000–2023 Apache Software Foundation. All rights reserved.