public class UrlUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
addParam(String url,
String name,
String value,
String charset)
Adds a query string param to the URL, adding a '?' if there's no query string yet.
|
static String |
addQueryStringFragment(String url,
String fragment)
Adds a query string fragment to the URL, adding a '?' if there's no query string yet.
|
static String |
concat(String mainUrl,
String... relativeUrls)
Concats two or more urls, adding any "/" needed between them.
|
static String |
concat(String mainUrl,
String relativeUrl)
Concats two urls, adding any "/" needed between them.
|
public static String concat(String mainUrl, String relativeUrl)
mainUrl - the main urlrelativeUrl - the relative urlpublic static String concat(String mainUrl, String... relativeUrls)
mainUrl - the main urlrelativeUrls - the array of relative urlspublic static String addParam(String url, String name, String value, String charset) throws UnsupportedEncodingException
url - the URLname - the name of the paramvalue - the value of the paramcharset - the charset to encode the param key/value withUnsupportedEncodingExceptionpublic static String addQueryStringFragment(String url, String fragment)
url - the URLfragment - the query string fragmentCopyright © 2018 CrafterCMS. All rights reserved.