Build 1.0_r1(from source)

android.net
Class UrlQuerySanitizer.IllegalCharacterValueSanitizer

java.lang.Object
  extended by android.net.UrlQuerySanitizer.IllegalCharacterValueSanitizer
All Implemented Interfaces:
UrlQuerySanitizer.ValueSanitizer
Enclosing class:
UrlQuerySanitizer

public static class UrlQuerySanitizer.IllegalCharacterValueSanitizer
extends Object
implements UrlQuerySanitizer.ValueSanitizer

Sanitize values based on which characters they contain. Illegal characters are replaced with either space or '_', depending upon whether space is a legal character or not.


Field Summary
static int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL
           Allow all but.
static int ALL_BUT_NUL_LEGAL
           Allow all special characters except Nul.
static int ALL_BUT_WHITESPACE_LEGAL
           Allow all special characters except for: whitespace characters Nul ('\0') Allow script URLs.
static int ALL_ILLEGAL
           Deny all special characters.
static int ALL_OK
          Mask with all fields set to OK
static int ALL_WHITESPACE_OK
          Mask with both regular space and other whitespace OK
static int AMP_AND_SPACE_LEGAL
           Allow ampersand.
static int AMP_LEGAL
           Allow ampersand.
static int AMP_OK
          Allow ampersand characters ('&')
static int DQUOTE_OK
          Allow double quote characters.
static int GT_OK
          Allow greater-than characters.
static int LT_OK
          Allow less-than characters.
static int NON_7_BIT_ASCII_OK
          Allow characters with character codes 128 to 255.
static int NUL_OK
          Allow nul characters ('\0')
static int OTHER_WHITESPACE_OK
          Allow whitespace characters other than space.
static int PCT_OK
          Allow percent-sign characters ('%')
static int SCRIPT_URL_OK
          Allow text to start with a script URL such as "javascript:" or "vbscript:"
static int SPACE_LEGAL
           Allow space.
static int SPACE_OK
          Allow space (' ') characters.
static int SQUOTE_OK
          Allow single quote characters.
static int URL_AND_SPACE_LEGAL
           Allow characters used by encoded URLs.
static int URL_LEGAL
           Allow characters used by encoded URLs.
 
Constructor Summary
UrlQuerySanitizer.IllegalCharacterValueSanitizer(int flags)
          Construct a sanitizer.
 
Method Summary
 String sanitize(String value)
          Sanitize a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_OK

public static final int SPACE_OK
Allow space (' ') characters.

See Also:
Constant Field Values

OTHER_WHITESPACE_OK

public static final int OTHER_WHITESPACE_OK
Allow whitespace characters other than space. The other whitespace characters are '\t' '\f' '\n' '\r' and '\0x000b' (vertical tab)

See Also:
Constant Field Values

NON_7_BIT_ASCII_OK

public static final int NON_7_BIT_ASCII_OK
Allow characters with character codes 128 to 255.

See Also:
Constant Field Values

DQUOTE_OK

public static final int DQUOTE_OK
Allow double quote characters. ('"')

See Also:
Constant Field Values

SQUOTE_OK

public static final int SQUOTE_OK
Allow single quote characters. ('\'')

See Also:
Constant Field Values

LT_OK

public static final int LT_OK
Allow less-than characters. ('<')>

See Also:
Constant Field Values

GT_OK

public static final int GT_OK
Allow greater-than characters. ('>')

See Also:
Constant Field Values

AMP_OK

public static final int AMP_OK
Allow ampersand characters ('&')

See Also:
Constant Field Values

PCT_OK

public static final int PCT_OK
Allow percent-sign characters ('%')

See Also:
Constant Field Values

NUL_OK

public static final int NUL_OK
Allow nul characters ('\0')

See Also:
Constant Field Values

SCRIPT_URL_OK

public static final int SCRIPT_URL_OK
Allow text to start with a script URL such as "javascript:" or "vbscript:"

See Also:
Constant Field Values

ALL_OK

public static final int ALL_OK
Mask with all fields set to OK

See Also:
Constant Field Values

ALL_WHITESPACE_OK

public static final int ALL_WHITESPACE_OK
Mask with both regular space and other whitespace OK

See Also:
Constant Field Values

ALL_ILLEGAL

public static final int ALL_ILLEGAL

See Also:
Constant Field Values

ALL_BUT_NUL_LEGAL

public static final int ALL_BUT_NUL_LEGAL

See Also:
Constant Field Values

ALL_BUT_WHITESPACE_LEGAL

public static final int ALL_BUT_WHITESPACE_LEGAL

See Also:
Constant Field Values

URL_LEGAL

public static final int URL_LEGAL

See Also:
Constant Field Values

URL_AND_SPACE_LEGAL

public static final int URL_AND_SPACE_LEGAL

See Also:
Constant Field Values

AMP_LEGAL

public static final int AMP_LEGAL

See Also:
Constant Field Values

AMP_AND_SPACE_LEGAL

public static final int AMP_AND_SPACE_LEGAL

See Also:
Constant Field Values

SPACE_LEGAL

public static final int SPACE_LEGAL

See Also:
Constant Field Values

ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL

public static final int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL

See Also:
Constant Field Values
Constructor Detail

UrlQuerySanitizer.IllegalCharacterValueSanitizer

public UrlQuerySanitizer.IllegalCharacterValueSanitizer(int flags)
Construct a sanitizer. The parameters set the behavior of the sanitizer.

Parameters:
flags - some combination of the XXX_OK flags.
Method Detail

sanitize

public String sanitize(String value)
Sanitize a value.
  1. If script URLs are not OK, the will be removed.
  2. If neither spaces nor other white space is OK, then white space will be trimmed from the beginning and end of the URL. (Just the actual white space characters are trimmed, not other control codes.)
  3. Illegal characters will be replaced with either ' ' or '_', depending on whether a space is itself a legal character.

Specified by:
sanitize in interface UrlQuerySanitizer.ValueSanitizer
Parameters:
value -
Returns:
the sanitized value

Build 1.0_r1(from source)

Please submit a feedback, bug or feature