Class UrlUtils


  • public final class UrlUtils
    extends Object
    Utils class for Url manipulation.
    • Method Detail

      • concat

        public static String concat​(String baseUriSpec,
                                    String uriSpec)
        Concatenate 2 URL Strings.
        Parameters:
        baseUriSpec - base url
        uriSpec - path part
        Returns:
        Concat URL
      • sanitizeBaseUrl

        public static String sanitizeBaseUrl​(String baseUriSpec,
                                             String uriSpec)
        Sanitize base url from current url by using the same scheme if http/https.
        Parameters:
        baseUriSpec - base URI
        uriSpec - current URI
        Returns:
        Sanitized base url
      • getAbsoluteUrlFromFile

        public static String getAbsoluteUrlFromFile​(String file)
        Converts a file String to a valid URL String.
        Example: index.html converts to file://C:/path/to/file/index.html.
        Parameters:
        file - the file String
        Returns:
        the URL String
      • getAbsoluteUrlPathFromFile

        public static String getAbsoluteUrlPathFromFile​(String file)
        Removes file name from URL string
        Parameters:
        file - the file String
        Returns:
        the URL String