| java.lang.Object com.caucho.portal.generic.HttpUtil
HttpUtil | public class HttpUtil (Code) | | HTTP utilities.
Encoding and decoding is for utf strings encoded with the rules defined for
the "application/x-www-form-urlencoded" MIME format.
|
Method Summary | |
public static String | decode(String source) Decode a string. | public static void | decode(String source, StringBuffer dest) Decode a string. | public static void | decode(String source, int beginIndex, int endIndex, StringBuffer dest) Extract and decode an encoded portion of a string. | public static void | decode(StringBuffer source, int beginIndex, int endIndex, StringBuffer dest) Extract and decode an encoded portion of a StringBuffer. | public static String | encode(String source) Encode a string. | public static void | encode(String source, StringBuffer dest) Encode a string. | public static void | encode(String source, int beginIndex, int endIndex, StringBuffer dest) Extract and encode a portion of a String. | public static void | encode(StringBuffer source, int beginIndex, int endIndex, StringBuffer dest) Extract and encode a portion of a StringBuffer. | public static void | encode(String source, Writer dest) Encode a string. | public static void | encode(String source, int beginIndex, int endIndex, Writer dest) Extract and encode a portion of a String. | public static void | encode(StringBuffer source, int beginIndex, int endIndex, Writer dest) Extract and encode a portion of a StringBuffer. | static char | encodeHex(int ch) | public static void | encodeUri(CharSequence source, int beginIndex, int endIndex, StringBuffer dest) | public static void | encodeUri(CharSequence source, int beginIndex, int endIndex, Writer dest) | public static String | extractParameters(Map<String, String[]> map, String url) Extract and decode parameters out of the query string portion of the path
and add them to the map. | public static String | extractParameters(Map<String, String[]> map, String url, int beginIndex) Extract and decode parameters out of the query string portion of the path
and add them to the map. | public static String | getFirstHeaderElement(String headerValue) Return only the first header element, null if headerValue is null or there
are no header elements. | public static Set<String> | getHeaderElements(String headerValue) Return an ordered Set of header elements from an http header. |
decode | public static String decode(String source)(Code) | | Decode a string.
Parameters: source - the String to decode the decoded String |
decode | public static void decode(String source, StringBuffer dest)(Code) | | Decode a string.
Parameters: source - the String to decode Parameters: dest - a StringBuffer that receives the decoded result |
decode | public static void decode(String source, int beginIndex, int endIndex, StringBuffer dest)(Code) | | Extract and decode an encoded portion of a string.
Parameters: source - the String to extract from Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a StringBuffer that receives the decoded result |
decode | public static void decode(StringBuffer source, int beginIndex, int endIndex, StringBuffer dest)(Code) | | Extract and decode an encoded portion of a StringBuffer.
Parameters: source - the StringBuffer to extract from Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a StringBuffer that receives the decoded result |
encode | public static String encode(String source)(Code) | | Encode a string.
Parameters: source - the String to encode the encoded String |
encode | public static void encode(String source, StringBuffer dest)(Code) | | Encode a string.
Parameters: source - the String to encode Parameters: dest - a StringBuffer that receives the encoded result |
encode | public static void encode(String source, int beginIndex, int endIndex, StringBuffer dest)(Code) | | Extract and encode a portion of a String.
Parameters: source - the String to encode Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a StringBuffer that receives the encoded result |
encode | public static void encode(StringBuffer source, int beginIndex, int endIndex, StringBuffer dest)(Code) | | Extract and encode a portion of a StringBuffer.
Parameters: source - the StringBuffer to encode Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a StringBuffer that receives the encoded result |
encode | public static void encode(String source, Writer dest) throws IOException(Code) | | Encode a string.
Parameters: source - the String to encode Parameters: dest - a Writer that receives the encoded result the encoded String |
encode | public static void encode(String source, int beginIndex, int endIndex, Writer dest) throws IOException(Code) | | Extract and encode a portion of a String.
Parameters: source - the String to encode Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a Writer that receives the encoded result |
encode | public static void encode(StringBuffer source, int beginIndex, int endIndex, Writer dest) throws IOException(Code) | | Extract and encode a portion of a StringBuffer.
Parameters: source - the StringBuffer to encode Parameters: beginIndex - the begin index, inclusive Parameters: endIndex - the end index, exclusive Parameters: dest - a Writer that receives the encoded result |
encodeHex | static char encodeHex(int ch)(Code) | | |
extractParameters | public static String extractParameters(Map<String, String[]> map, String url)(Code) | | Extract and decode parameters out of the query string portion of the path
and add them to the map. The parameters are found by looking for the '?'
character.
Parameters: map - the Map to put the parameters in Parameters: url - the url |
extractParameters | public static String extractParameters(Map<String, String[]> map, String url, int beginIndex)(Code) | | Extract and decode parameters out of the query string portion of the path
and add them to the map.
Parameters: map - the Map to put the parameters in Parameters: url - the url Parameters: beginIndex - the index of the character that follows the '?' character |
getFirstHeaderElement | public static String getFirstHeaderElement(String headerValue)(Code) | | Return only the first header element, null if headerValue is null or there
are no header elements.
A headerValue with a String like "text/html; charset=xxx" returns
"text/html".
A headerValue with a String like " en; q=1.0, fr; q=0.8 "
returns "en".
|
getHeaderElements | public static Set<String> getHeaderElements(String headerValue)(Code) | | Return an ordered Set of header elements from an http header. If there
are no header elements found, null is returned.
text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.8, image/*; q=0.5
returns:
- text/html
- text/*
- image/gif
- image/jpeg
- image/*
Note that the qs value is ignored.
null or a Set with at least one elemement |
|
|