/**@class android.net.UrlQuerySanitizer @extends java.lang.Object Sanitizes the Query portion of a URL. Simple example: <code> UrlQuerySanitizer sanitizer = new UrlQuerySanitizer(); sanitizer.setAllowUnregisteredParamaters(true); sanitizer.parseUrl("http://example.com/?name=Joe+User"); String name = sanitizer.getValue("name")); // name now contains "Joe_User" </code> Register ValueSanitizers to customize the way individual parameters are sanitized: <code> UrlQuerySanitizer sanitizer = new UrlQuerySanitizer(); sanitizer.registerParamater("name", UrlQuerySanitizer.createSpaceLegal()); sanitizer.parseUrl("http://example.com/?name=Joe+User"); String name = sanitizer.getValue("name")); // name now contains "Joe User". (The string is first decoded, which // converts the '+' to a ' '. Then the string is sanitized, which // converts the ' ' to an '_'. (The ' ' is converted because the default unregistered parameter sanitizer does not allow any special characters, and ' ' is a special character.) </code> There are several ways to create ValueSanitizers. In order of increasing sophistication: <ol> <li>Call one of the UrlQuerySanitizer.createXXX() methods. <li>Construct your own instance of UrlQuerySanitizer.IllegalCharacterValueSanitizer. <li>Subclass UrlQuerySanitizer.ValueSanitizer to define your own value sanitizer. </ol> */ var UrlQuerySanitizer = { /**Get the current value sanitizer used when processing unregistered parameter values. <p> <b>Note:</b> The default unregistered parameter value sanitizer is one that doesn't allow any special characters, similar to what is returned by calling createAllIllegal. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} the current ValueSanitizer used to sanitize unregistered parameter values. */ getUnregisteredParameterValueSanitizer : function( ) {}, /**Set the value sanitizer used when processing unregistered parameter values. @param {Object {UrlQuerySanitizer.ValueSanitizer}} sanitizer set the ValueSanitizer used to sanitize unregistered parameter values. */ setUnregisteredParameterValueSanitizer : function( ) {}, /**Return a value sanitizer that does not allow any special characters, and also does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAllIllegal : function( ) {}, /**Return a value sanitizer that allows everything except Nul ('\0') characters. Script URLs are allowed. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAllButNulLegal : function( ) {}, /**Return a value sanitizer that allows everything except Nul ('\0') characters, space (' '), and other whitespace characters. Script URLs are allowed. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAllButWhitespaceLegal : function( ) {}, /**Return a value sanitizer that allows all the characters used by encoded URLs. Does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getUrlLegal : function( ) {}, /**Return a value sanitizer that allows all the characters used by encoded URLs and allows spaces, which are not technically legal in encoded URLs, but commonly appear anyway. Does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getUrlAndSpaceLegal : function( ) {}, /**Return a value sanitizer that does not allow any special characters except ampersand ('&'). Does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAmpLegal : function( ) {}, /**Return a value sanitizer that does not allow any special characters except ampersand ('&') and space (' '). Does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAmpAndSpaceLegal : function( ) {}, /**Return a value sanitizer that does not allow any special characters except space (' '). Does not allow script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getSpaceLegal : function( ) {}, /**Return a value sanitizer that allows any special characters except angle brackets ('<' and '>') and Nul ('\0'). Allows script URLs. @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} a value sanitizer */ getAllButNulAndAngleBracketsLegal : function( ) {}, /**Parse the query parameters out of an encoded URL. Works by extracting the query portion from the URL and then calling parseQuery(). If there is no query portion it is treated as if the query portion is an empty string. @param {String} url the encoded URL to parse. */ parseUrl : function( ) {}, /**Parse a query. A query string is any number of parameter-value clauses separated by any non-zero number of ampersands. A parameter-value clause is a parameter followed by an equal sign, followed by a value. If the equal sign is missing, the value is assumed to be the empty string. @param {String} query the query to parse. */ parseQuery : function( ) {}, /**Get a set of all of the parameters found in the sanitized query. <p> Note: Do not modify this set. Treat it as a read-only set. @return {Object {java.util.Set}} all the parameters found in the current query. */ getParameterSet : function( ) {}, /**An array list of all of the parameter value pairs in the sanitized query, in the order they appeared in the query. May contain duplicate parameters. <p class="note"><b>Note:</b> Do not modify this list. Treat it as a read-only list.</p> */ getParameterList : function( ) {}, /**Check if a parameter exists in the current sanitized query. @param {String} parameter the unencoded name of a parameter. @return {Boolean} true if the paramater exists in the current sanitized queary. */ hasParameter : function( ) {}, /**Get the value for a parameter in the current sanitized query. Returns null if the parameter does not exit. @param {String} parameter the unencoded name of a parameter. @return {String} the sanitized unencoded value of the parameter, or null if the parameter does not exist. */ getValue : function( ) {}, /**Register a value sanitizer for a particular parameter. Can also be used to replace or remove an already-set value sanitizer. <p> Registering a non-null value sanitizer for a particular parameter makes that parameter a registered parameter. @param {String} parameter an unencoded parameter name @param {Object {UrlQuerySanitizer.ValueSanitizer}} valueSanitizer the value sanitizer to use for a particular parameter. May be null in order to unregister that parameter. @see #getAllowUnregisteredParamaters() */ registerParameter : function( ) {}, /**Register a value sanitizer for an array of parameters. @param {Object {java.lang.String[]}} parameters An array of unencoded parameter names. @param {Object {UrlQuerySanitizer.ValueSanitizer}} valueSanitizer @see #registerParameter */ registerParameters : function( ) {}, /**Set whether or not unregistered parameters are allowed. If they are not allowed, then they will be dropped when a query is sanitized. <p> Defaults to false. @param {Boolean} allowUnregisteredParamaters true to allow unregistered parameters. @see #getAllowUnregisteredParamaters() */ setAllowUnregisteredParamaters : function( ) {}, /**Get whether or not unregistered parameters are allowed. If not allowed, they will be dropped when a query is parsed. @return {Boolean} true if unregistered parameters are allowed. @see #setAllowUnregisteredParamaters(boolean) */ getAllowUnregisteredParamaters : function( ) {}, /**Set whether or not the first occurrence of a repeated parameter is preferred. True means the first repeated parameter is preferred. False means that the last repeated parameter is preferred. <p> The preferred parameter is the one that is returned when getParameter is called. <p> defaults to false. @param {Boolean} preferFirstRepeatedParameter True if the first repeated parameter is preferred. @see #getPreferFirstRepeatedParameter() */ setPreferFirstRepeatedParameter : function( ) {}, /**Get whether or not the first occurrence of a repeated parameter is preferred. @return {Boolean} true if the first occurrence of a repeated parameter is preferred. @see #setPreferFirstRepeatedParameter(boolean) */ getPreferFirstRepeatedParameter : function( ) {}, /**Get the value sanitizer for a parameter. Returns null if there is no value sanitizer registered for the parameter. @param {String} parameter the unescaped parameter @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} the currently registered value sanitizer for this parameter. @see #registerParameter(String, android.net.UrlQuerySanitizer.ValueSanitizer) */ getValueSanitizer : function( ) {}, /**Get the effective value sanitizer for a parameter. Like getValueSanitizer, except if there is no value sanitizer registered for a parameter, and unregistered paramaters are allowed, then the default value sanitizer is returned. @param {String} parameter an unescaped parameter @return {Object {android.net.UrlQuerySanitizer.ValueSanitizer}} the effective value sanitizer for a parameter. */ getEffectiveValueSanitizer : function( ) {}, /**Unescape an escaped string. <ul> <li>'+' characters are replaced by ' ' characters. <li>Valid "%xx" escape sequences are replaced by the corresponding unescaped character. <li>Invalid escape sequences such as %1z", are passed through unchanged. <ol> @param {String} string the escaped string @return {String} the unescaped string. */ unescape : function( ) {}, };