public final class RequestUtil extends Object
| Constructor and Description |
|---|
RequestUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
deRelativize(boolean absolutize,
String path)
Normalize a relative URI path that may have relative values ("/./",
"/../", and so on ) it it.
|
static String |
filter(String message)
Filter the specified message string for characters that are sensitive in
HTML.
|
static String |
normalize(boolean absolutize,
String... path) |
static String |
parseCharacterEncoding(String contentType)
Parse the character encoding from the specified content type header.
|
static Locale |
parseLocale(String header)
Shamelessly copied from: http://stackoverflow.com/questions/6824157/parse-accept-language-header-in-java
|
static void |
parseParameters(Map<String,String[]> map,
byte[] data,
String encoding)
Append request parameters from the specified String to the specified Map.
|
static void |
parseParameters(Map<String,String[]> map,
String data,
String encoding)
Append request parameters from the specified String to the specified Map.
|
static Map<Double,String> |
parseQualityHeader(String header)
Encode a cookie as per RFC 2109.
|
static String |
URLDecode(byte[] bytes)
Decode and return the specified URL-encoded byte array.
|
static String |
URLDecode(byte[] bytes,
String enc)
Decode and return the specified URL-encoded byte array.
|
static String |
URLDecode(String str)
Decode and return the specified URL-encoded String.
|
static String |
URLDecode(String str,
String enc)
Decode and return the specified URL-encoded String.
|
public static Locale parseLocale(String header)
public static Map<Double,String> parseQualityHeader(String header)
Set-Cookie header.cookie - The cookie to encode.public static String filter(String message)
message - The message string to be filteredpublic static String deRelativize(boolean absolutize, String path)
absolutize - path - Relative path to be normalizedpublic static String parseCharacterEncoding(String contentType)
null is returned.contentType - a content type headerpublic static void parseParameters(Map<String,String[]> map, String data, String encoding) throws UnsupportedEncodingException
IMPLEMENTATION NOTE: URL decoding is performed individually on the parsed name and value elements, rather than on the entire query string ahead of time, to properly deal with the case where the name or value includes an encoded "=" or "&" character that would otherwise be interpreted as a delimiter.
map - Map that accumulates the resulting parametersdata - Input string containing request parametersIllegalArgumentException - if the data is malformedUnsupportedEncodingExceptionpublic static String URLDecode(String str)
str - The url-encoded stringIllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal
numberpublic static String URLDecode(String str, String enc)
str - The url-encoded stringenc - The encoding to use; if null, the default encoding is usedIllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal
numberpublic static String URLDecode(byte[] bytes)
bytes - The url-encoded byte arrayIllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal
numberpublic static String URLDecode(byte[] bytes, String enc)
bytes - The url-encoded byte arrayenc - The encoding to use; if null, the default encoding is usedIllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal
numberpublic static void parseParameters(Map<String,String[]> map, byte[] data, String encoding) throws UnsupportedEncodingException
IMPLEMENTATION NOTE: URL decoding is performed individually on the parsed name and value elements, rather than on the entire query string ahead of time, to properly deal with the case where the name or value includes an encoded "=" or "&" character that would otherwise be interpreted as a delimiter. NOTE: byte array data is modified by this method. Caller beware.
map - Map that accumulates the resulting parametersdata - Input string containing request parametersencoding - Encoding to use for converting hexUnsupportedEncodingException - if the data is malformedCopyright © 2006-2015. All Rights Reserved.