Class URLCheckers


  • public class URLCheckers
    extends Object
    Scans for all available URLChecker implementations, allows to register new ones, and provides a convenient method to apply them on a given location.
    • Field Detail

      • LOGGER

        protected static final Logger LOGGER
    • Constructor Detail

      • URLCheckers

        public URLCheckers()
    • Method Detail

      • reset

        public static void reset()
        Re-initializes all static state, in particular, the URLChecker service registry
      • register

        public static void register​(URLChecker checker)
        Dynamically register a new URLChecker. The operation removes all instances of the same classes already present in the registry, if multiple instances are needed, one can use subclasses (eventually, anonymous inner classes) so that the instances are not sharing exactly the same class.
      • deregister

        public static void deregister​(URLChecker checker)
        Dynamically removes a new URLChecker, that might have been registered using the register(URLChecker) method.
      • getEnabledURLCheckers

        public static List<URLChecker> getEnabledURLCheckers()
        Returns:
        enabled list of org.geotools.data.ows.URLChecker implementations
      • confirm

        public static void confirm​(URL url)
                            throws URLCheckerException
        Confirm the URL against all enabled URLChecker
        Parameters:
        url - to confirm using all available URLCheckers
        Throws:
        URLCheckerException - if the URL is not allowed for use
      • confirm

        public static void confirm​(URI uri)
                            throws URLCheckerException
        Confirms URI against all enabled URLChecker
        Parameters:
        uri - to evaluate using all available URLCheckers
        Throws:
        URLCheckerException - if the URI is not allowed for use
      • normalize

        public static String normalize​(String location)
        Normalize location removing current directory . and parent directory .. names.

        Normalization uses URI.normalize() for URI and URL locations. Path locations are normalized using Path.normalize().

        This normalization method forces empty hostname file:///path representation to provide a consistent location to check. RFC 8089 supports both empty hostname file:///path and file:/path no hostname as references to the same absolute path.

        Keep in mind that file paths are standardized to / on linux and \\ on windows.

        Parameters:
        location - String(URI/URI/path)
        Returns:
        normalized location, removing redundant . and .. path names if required
      • confirm

        public static void confirm​(String location)
                            throws URLCheckerException
        Confirm the location against all enabled URLChecker.
        Parameters:
        location - String(URI/URI/path) to be normalized and evaluated using all available URLCheckers
        Throws:
        URLCheckerException - if the location is not allowed for use