Class URLUtils


  • public class URLUtils
    extends Object
    • Constructor Detail

      • URLUtils

        public URLUtils()
    • Method Detail

      • resolve

        public static URL resolve​(URL base,
                                  String spec)
                           throws MalformedURLException
        Resolves a URL against a base URL.

        Context: this helper was introduced when migrating callers from using java.net.URL constructors to URI. The raw URI.resolve semantics differ in a few corner cases from URL-based resolution did. To avoid scattering ad-hoc fixes across the codebase, the normalization logic lives here so resolution behavior is consistent and easier to maintain.

        Parameters:
        base - the base URL
        spec - the URL specification to resolve
        Returns:
        the resolved URL
        Throws:
        MalformedURLException - if the URL cannot be resolved