Class URLHelper


  • public final class URLHelper
    extends Object
    A collection of useful static methods to deal with URLs.
    Since:
    3.5.0
    Author:
    Mohammed Shaik Hussain Ali
    See Also:
    URL
    • Method Detail

      • isValidURL

        public static boolean isValidURL​(String url)
        Returns true if the passed string is a valid URL, false otherwise.

        Example Usage:
             URLHelper.isValidURL("http://userid@example.com")       //  true
             URLHelper.isValidURL("www.example.com/main.html")       //  false
         
        Parameters:
        url - to check
        Returns:
        if the string is a valid URL
        Since:
        3.5.0
      • appendQuery

        public static String appendQuery​(String url,
                                         String param,
                                         Object value)
        Appends content to the query string of a URL, handling logic for whether to place a question mark or ampersand.
        Parameters:
        url - The URL to append to.
        param - The parameter key to append to the URL.
        value - The parameter value to append to the URL.
        Returns:
        The resulting URL
        Throws:
        IllegalArgumentException - for Invalid URL or empty arguments
        Since:
        3.5.0