java.lang.Object | |
↳ | com.google.gwt.safehtml.shared.UriUtils |
Utility class containing static methods for validating and sanitizing URIs.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Extracts the scheme of a URI.
| |||||||||||
Determines if a
String is safe to use as the value of a URI-valued
HTML attribute such as src or href . | |||||||||||
Sanitizes a URI.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Extracts the scheme of a URI.
uri | the URI to extract the scheme from |
---|
null
if the URI does not have one
Determines if a String
is safe to use as the value of a URI-valued
HTML attribute such as src
or href
.
In this context, a URI is safe if it can be established that using it as
the value of a URI-valued HTML attribute such as src
or href
cannot result in script execution. Specifically, this method deems a
URI safe if it either does not have a scheme, or its scheme is one of
http, https, ftp, mailto
.
uri | the URI to validate |
---|
true
if uri
is safe in the above sense; false
otherwise
Sanitizes a URI.
This method returns the URI provided if it is safe to use as the the value
of a URI-valued HTML attribute according to isSafeUri(String)
, or the URI
"#
" otherwise.
uri | the URI to sanitize |
---|