Class LaxURLCodec
java.lang.Object
org.apache.commons.codec.net.URLCodec
org.archive.url.LaxURLCodec
- All Implemented Interfaces:
org.apache.commons.codec.BinaryDecoder,org.apache.commons.codec.BinaryEncoder,org.apache.commons.codec.Decoder,org.apache.commons.codec.Encoder,org.apache.commons.codec.StringDecoder,org.apache.commons.codec.StringEncoder
public class LaxURLCodec
extends org.apache.commons.codec.net.URLCodec
- Author:
- gojomo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic LaxURLCodecstatic BitSetA more expansive set of ASCII URI characters to consider as 'safe' to leave unencoded, based on actual browser behavior.static BitSetFields inherited from class org.apache.commons.codec.net.URLCodec
charset, ESCAPE_CHAR, WWW_FORM_URL -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.codec.net.URLCodec
decode, decode, decode, decode, decodeUrl, encode, encode, encode, encode, encodeUrl, getDefaultCharset, getEncoding
-
Field Details
-
DEFAULT
-
EXPANDED_URI_SAFE
A more expansive set of ASCII URI characters to consider as 'safe' to leave unencoded, based on actual browser behavior. -
QUERY_SAFE
-
-
Constructor Details
-
LaxURLCodec
-
-
Method Details
-
decodeUrlLoose
public static final byte[] decodeUrlLoose(byte[] bytes) Decodes an array of URL safe 7-bit characters into an array of original bytes. Escaped characters are converted back to their original representation. Differs from URLCodec.decodeUrl() in that it throws no exceptions; bad or incomplete escape sequences are ignored and passed into result undecoded. This matches the behavior of browsers, which will use inconsistently-encoded URIs in HTTP request-lines.- Parameters:
bytes- array of URL safe characters- Returns:
- array of original bytes
-
encode
Encodes a string into its URL safe form using the specified string charset. Unsafe characters are escaped. This method is analogous to superclass encode() methods, additionally offering the ability to specify a different 'safe' character set (such as EXPANDED_URI_SAFE).- Parameters:
safe- BitSet of characters that don't need to be encodedpString- String to encodecs- Name of character set to use- Returns:
- Encoded version of
pString. - Throws:
UnsupportedEncodingException
-