Package eu.woolplatform.utils.http
Class URLParameters
- java.lang.Object
-
- eu.woolplatform.utils.http.URLParameters
-
public class URLParameters extends Object
Methods for creating and parsing URL-encoded parameter strings.
-
-
Constructor Summary
Constructors Constructor Description URLParameters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,String>extractParameters(String url)Extracts a parameter string from the specified URL and parses it into a map.static StringextractParameterString(String url)Extracts a parameter string from the specified URL.static StringgetParameterString(Map<String,String> params)Creates a URL-encoded parameter string for the specified parameters.static StringgetSortedParameterString(Map<String,String> params)Creates a URL-encoded parameter string for the specified parameters.static Map<String,String>parseParameterString(String paramStr)Parses a URL-encoded parameter string.
-
-
-
Method Detail
-
getSortedParameterString
public static String getSortedParameterString(Map<String,String> params)
Creates a URL-encoded parameter string for the specified parameters. They will first be sorted by key. It uses UTF-8.- Parameters:
params- the parameters- Returns:
- the parameter string
-
getParameterString
public static String getParameterString(Map<String,String> params)
Creates a URL-encoded parameter string for the specified parameters. It uses UTF-8.- Parameters:
params- the parameters- Returns:
- the parameter string
-
parseParameterString
public static Map<String,String> parseParameterString(String paramStr) throws ParseException
Parses a URL-encoded parameter string. It uses UTF-8.- Parameters:
paramStr- the parameter string- Returns:
- the parameters
- Throws:
ParseException- if the parameter string is invalid
-
extractParameterString
public static String extractParameterString(String url)
Extracts a parameter string from the specified URL. It will search for a ? and return everything after that until a possible #. If there is no ? this method returns null.- Parameters:
url- the URL- Returns:
- the parameter string or null
-
extractParameters
public static Map<String,String> extractParameters(String url) throws ParseException
Extracts a parameter string from the specified URL and parses it into a map. It uses UTF-8. If the URL doesn't have a parameter string, this method returns null. This is a convenience method forextractParameterString()andparseParameterString().- Parameters:
url- the URL- Returns:
- the parameter map or null
- Throws:
ParseException- if the parameter string is invalid
-
-