Package de.xima.fc.utils
Class URLUtils
- java.lang.Object
-
- de.xima.fc.utils.URLUtils
-
public class URLUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description URLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
addParameterToURL(String url, String paramName, String paramValue)
static String
addParameterToURL(String url, String paramName, String paramValue, boolean useEncoding)
static String
addQueryStringToUrl(String url, String queryString, Predicate<String> predicate)
Adds each query parameter from the query string to which the predicate applies to the given URL.static String
addQueryStringToUrl(String url, Map<String,String[]> queryStringParams, Predicate<String> predicate)
static String
addQueryStringToURL(String url, String queryString)
static String
addQueryStringToURL(String url, String queryString, de.xima.cmn.filter.IGenericFilter<String> predicate)
Deprecated.static String
addQueryStringToURL(String url, Map<String,String[]> queryStringParams)
Adds all query parameters to the given URL.static String
addQueryStringToURL(String url, Map<String,String[]> queryStringParams, de.xima.cmn.filter.IGenericFilter<String> predicate)
Deprecated.static String
changeScheme(String url, String newScheme)
Changes the scheme of a URL (such ashttps
) to the given schema.static String
decrypt(String str)
Methode zum Entschlüsseln eines Stringsstatic String
encrypt(String str)
Methode zum Verschlüsseln eines Stringsstatic Map<String,String[]>
getUrlParameters(String queryString)
static String
removeParameter(String url, String paramName)
static String
removeParameter(String url, String paramName, boolean useEncoding)
static String
setParameter(String url, String paramName, String paramValue)
static String
setParameter(String url, String paramName, String paramValue, boolean useEncoding)
-
-
-
Method Detail
-
addParameterToURL
public static String addParameterToURL(String url, String paramName, String paramValue)
-
addParameterToURL
public static String addParameterToURL(String url, String paramName, String paramValue, boolean useEncoding)
-
setParameter
public static String setParameter(String url, String paramName, String paramValue, boolean useEncoding)
-
changeScheme
public static String changeScheme(String url, String newScheme)
Changes the scheme of a URL (such ashttps
) to the given schema.- Parameters:
url
- URL to modify.newScheme
- New schema for the URL.- Returns:
- The URL with the new scheme.
-
removeParameter
public static String removeParameter(String url, String paramName, boolean useEncoding)
-
addQueryStringToURL
@Deprecated public static String addQueryStringToURL(String url, String queryString, de.xima.cmn.filter.IGenericFilter<String> predicate)
Deprecated.Adds each query parameter from the query string to which the predicate applies to the given URL.- Parameters:
url
- URL to process.queryString
- A query string to add to the URL, such as {@link ?foo=bar&hello=world}.predicate
- Predicate that checks whether the parameter should be added. Only parameters to which the predicate applies are added.- Returns:
- The given URL with the query parameters to which the predicate applies added.
-
addQueryStringToUrl
public static String addQueryStringToUrl(String url, String queryString, Predicate<String> predicate)
Adds each query parameter from the query string to which the predicate applies to the given URL.- Parameters:
url
- URL to process.queryString
- A query string to add to the URL, such as {@link ?foo=bar&hello=world}.predicate
- Predicate that checks whether the parameter should be added. Only parameters to which the predicate applies are added.- Returns:
- The given URL with the query parameters to which the predicate applies added.
-
addQueryStringToURL
public static String addQueryStringToURL(String url, Map<String,String[]> queryStringParams)
Adds all query parameters to the given URL.- Parameters:
url
- URL to process.queryStringParams
- Query parameters to add. applies are added.- Returns:
- The given URL with the parameters added.
-
addQueryStringToURL
@Deprecated public static String addQueryStringToURL(String url, Map<String,String[]> queryStringParams, de.xima.cmn.filter.IGenericFilter<String> predicate)
Deprecated.Adds all query parameters to the given URL.- Parameters:
url
- URL to process.queryStringParams
- Query parameters to add.predicate
- Predicate that checks whether the parameter should be added. Only parameters to which the predicate applies are added.- Returns:
- The given URL with the parameters to which the predicate applies.
-
addQueryStringToUrl
public static String addQueryStringToUrl(String url, Map<String,String[]> queryStringParams, Predicate<String> predicate)
- Parameters:
url
- URL to process.queryStringParams
- Query parameters to add.predicate
- Predicate that checks whether the parameter should be added. Only parameters to which the predicate applies are added.- Returns:
- The given URL with the parameters to which the predicate applies..
-
getUrlParameters
public static Map<String,String[]> getUrlParameters(String queryString) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
encrypt
public static String encrypt(String str)
Methode zum Verschlüsseln eines Strings- Parameters:
str
- String to encrypt- Returns:
- the encrypted String
-
-