public final class URLUtility extends Object
Utility class which handles URL operations.
| Modifier and Type | Method and Description |
|---|---|
static String |
changeLanguageForUrl(String url)
Generates a new URL to the API using the fallback
Locale
FALLBACK_LOCALE. |
static String |
changeLanguageForUrl(String url,
Locale locale)
Generates a new URL to the API using the specified locale.
|
static String |
changeLanguageForUrl(String url,
String language)
Generates a new URL to the API by replacing the current language tag in the URL
with the specified language tag.
|
static String |
getRootUrl()
Returns the root URL for the API.
|
static String |
getRootUrl(Locale locale)
Returns the root URL for the API for a specific
Locale. |
public static String getRootUrl()
Returns the root URL for the API.
ROOT_URLpublic static String getRootUrl(Locale locale)
Returns the root URL for the API for a specific Locale.
locale - the LocaleROOT_URL with a converted language tag segment to match the specified
Localepublic static String changeLanguageForUrl(String url)
Generates a new URL to the API using the fallback Locale
FALLBACK_LOCALE.
See changeLanguageForUrl(String, String) for implementation
details.
url - the URL to editpublic static String changeLanguageForUrl(String url, Locale locale)
Generates a new URL to the API using the specified locale.
See changeLanguageForUrl(String, String) for implementation
details.
url - the URL to editlocale - the locale to usepublic static String changeLanguageForUrl(String url, String language)
Generates a new URL to the API by replacing the current language tag in the URL with the specified language tag.
This method performs these steps to figure out what needs to be replaced:
Due to speed efficiency, this method does not perform any validity check on the specified URL. Calling this method without a valid URL for the API may (and probably will) result in unexpected behavior.
url - the URL to editlanguage - the language to useCopyright © 2017. All rights reserved.