Class URLUtils

java.lang.Object
org.dspace.app.rest.utils.URLUtils

public class URLUtils extends Object
Utility class to encode or decode URL
  • Method Details

    • decode

      public static String decode(String url)
      Decode a given URL
      Parameters:
      url - URL
      Returns:
      decoded URL
    • encode

      public static String encode(String url)
      Encode a given URL
      Parameters:
      url - URL
      Returns:
      encoded URL
    • urlIsPrefixOf

      public static boolean urlIsPrefixOf(String pattern, String candidate) throws IllegalArgumentException
      Is one URL a prefix of another? Ignores credentials, fragments and queries.
      Parameters:
      pattern - the potential prefix.
      candidate - does this URL match the pattern?
      Returns:
      true if the URLs have equal protocol, host and port, and each element of candidate's path String.equals(java.lang.Object) the corresponding element in pattern's path.
      Throws:
      IllegalArgumentException - if either URL is malformed.