Share via


UrlQuerySanitizer Class

Definition

Sanitizes the Query portion of a URL.

[Android.Runtime.Register("android/net/UrlQuerySanitizer", DoNotGenerateAcw=true)]
public class UrlQuerySanitizer : Java.Lang.Object
[<Android.Runtime.Register("android/net/UrlQuerySanitizer", DoNotGenerateAcw=true)>]
type UrlQuerySanitizer = class
    inherit Object
Inheritance
UrlQuerySanitizer
Attributes

Remarks

Sanitizes the Query portion of a URL. Simple example:

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"

Register ValueSanitizers to customize the way individual parameters are sanitized:

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.)

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>

Java documentation for android.net.UrlQuerySanitizer.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

UrlQuerySanitizer()

Constructs a UrlQuerySanitizer.

UrlQuerySanitizer(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

UrlQuerySanitizer(String)

Constructs a UrlQuerySanitizer and parses a URL.

Properties

AllButNulAndAngleBracketsLegal

Return a value sanitizer that allows any special characters except angle brackets ('<' and '>') and Nul ('\0').

AllButNulLegal

Return a value sanitizer that allows everything except Nul ('\0') characters.

AllButWhitespaceLegal

Return a value sanitizer that allows everything except Nul ('\0') characters, space (' '), and other whitespace characters.

AllIllegal

Return a value sanitizer that does not allow any special characters, and also does not allow script URLs.

AllowUnregisteredParamaters

Get whether or not unregistered parameters are allowed. -or- Set whether or not unregistered parameters are allowed.

AmpAndSpaceLegal

Return a value sanitizer that does not allow any special characters except ampersand ('&') and space (' ').

AmpLegal

Return a value sanitizer that does not allow any special characters except ampersand ('&').

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
ParameterList

An array list of all of the parameter-value pairs in the sanitized query, in the order they appeared in the query.

ParameterSet

Get a set of all of the parameters found in the sanitized query.

PeerReference (Inherited from Object)
PreferFirstRepeatedParameter

Get whether or not the first occurrence of a repeated parameter is preferred. -or- Set whether or not the first occurrence of a repeated parameter is preferred.

SpaceLegal

Return a value sanitizer that does not allow any special characters except space (' ').

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

UnregisteredParameterValueSanitizer

Get the current value sanitizer used when processing unregistered parameter values. -or- Set the value sanitizer used when processing unregistered parameter values.

UrlAndSpaceLegal

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.

UrlLegal

Return a value sanitizer that allows all the characters used by encoded URLs.

Methods

AddSanitizedEntry(String, String)

Record a sanitized parameter-value pair.

Clear()

Clear the existing entries.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DecodeHexDigit(Char)

Convert a character that represents a hexidecimal digit into an integer.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetEffectiveValueSanitizer(String)

Get the effective value sanitizer for a parameter.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetValue(String)

Get the value for a parameter in the current sanitized query.

GetValueSanitizer(String)

Get the value sanitizer for a parameter.

HasParameter(String)

Check if a parameter exists in the current sanitized query.

IsHexDigit(Char)

Test if a character is a hexidecimal digit.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ParseEntry(String, String)

Parse an escaped parameter-value pair.

ParseQuery(String)

Parse a query.

ParseUrl(String)

Parse the query parameters out of an encoded URL.

RegisterParameter(String, UrlQuerySanitizer+IValueSanitizer)

Register a value sanitizer for a particular parameter.

RegisterParameters(String[], UrlQuerySanitizer+IValueSanitizer)

Register a value sanitizer for an array of parameters.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
Unescape(String)

Unescape an escaped string.

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to