Package org.dspace.app.rest.utils
Class URLUtils
- java.lang.Object
-
- org.dspace.app.rest.utils.URLUtils
-
public class URLUtils extends Object
Utility class to encode or decode URL
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringdecode(String url)Decode a given URLstatic Stringencode(String url)Encode a given URLstatic booleanurlIsPrefixOf(String pattern, String candidate)Is one URL a prefix of another? Ignores credentials, fragments and queries.
-
-
-
Method Detail
-
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:
trueif the URLs have equal protocol, host and port, and each element ofcandidate's pathString.equals(java.lang.Object)the corresponding element inpattern's path.- Throws:
IllegalArgumentException- if either URL is malformed.
-
-