|
OracleAS PDK for Java 9.0.4.0.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--oracle.webdb.utils.HTTPUtils
This class contains various utility methods for encoding and decoding URIs
String using the set of characters allowed in a URI, as defined
in RFC 2396 - "Uniform
Resource Identifiers (URI): Generic Syntax". The method does not suffer
from the limitations of the java.net.URLEncoder in that it
provides control over the character encoding used for character to byte
conversions and is capable of encoding characters that are encoded by a
sequence of several bytes.
To convert a String, each character is examined in turn:
a' through 'z',
'A' through 'Z', and '0' through
'9' remain the same.
-', '_',
'.', '!', '~', '*',
''' , '(', ')', remain the same.
' is converted into a
plus sign '+'.
%xy", where xy is the two-digit
hexadecimal representation of the byte value.
| Constructor Summary | |
HTTPUtils()
|
|
| Method Summary | |
static java.lang.String |
buildUrlAsString(java.lang.String scheme,
java.lang.String host,
int port,
java.lang.String path)
Build a fully qualified URL from the pieces provided. |
static java.lang.String |
decode(java.lang.String value,
java.lang.String encoding)
Decodes an encoded String. |
static java.lang.String |
decodeUTF(java.lang.String value)
Decodes an encoded UTF8 String. |
static java.lang.String |
encode(java.lang.String value,
java.lang.String encoding)
Encodes a String using the set of characters allowed in a URI. |
static java.lang.String |
encodeUTF(java.lang.String value)
Encodes a String using the set of characters allowed in a URI. |
static java.lang.String |
getCookie(java.lang.String cookieName,
java.lang.String cookies)
Extracts a cookie value from a list of cookies based on the name. |
static boolean |
isErrorStatusCode(int statusCode)
Determines whether the given HTTP status code denotes a client or server error. |
static boolean |
needsDecoding(java.lang.String token)
Determine if a value needs to be decoded using HTTPUtils.decode() This method assumes that a value is encoded. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HTTPUtils()
| Method Detail |
public static java.lang.String buildUrlAsString(java.lang.String scheme,
java.lang.String host,
int port,
java.lang.String path)
scheme - server protocol.host - server name.port - server port.path - properly encoded relative URL.
java.lang.IllegalArgumentException - if scheme, host or port is null.
public static java.lang.String encode(java.lang.String value,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
value - String to be translated.encoding - the Java alias for the character encoding to be used to
convert non-ASCII characters into bytes (e.g. "UTF8").
String.
java.io.UnsupportedEncodingException - if the given encoding is not a
recognised character encoding.public static java.lang.String encodeUTF(java.lang.String value)
value - String to be translated.
String.
public static java.lang.String decode(java.lang.String value,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
value - String to be translated.encoding - the Java alias for the character encoding to be used to
convert byte sequences into characters(e.g. "UTF8").
String.
java.io.UnsupportedEncodingException - if the given encoding is not a
recognised character encoding.public static java.lang.String decodeUTF(java.lang.String value)
value - String to be translated.
String.public static boolean isErrorStatusCode(int statusCode)
statusCode - an HTTP response status code
public static final boolean needsDecoding(java.lang.String token)
public static java.lang.String getCookie(java.lang.String cookieName,
java.lang.String cookies)
cookieName - Name of the cookie to search for.cookies - List of cookies of the form
"name1=value1; name2=value2; ...; nameN=valueN".
|
OracleAS PDK for Java 9.0.4.0.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||