java.lang.Object | |
↳ | com.urbanairship.UrlAllowList |
Defines a set of URL patterns to match a URL.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | UrlAllowList.OnUrlAllowListCallback | Interface that defines a callback that can be used to reject or allow a URL. | |||||||||
@interface | UrlAllowList.Scope |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | SCOPE_ALL | UrlAllowList entry applies to both url and JS interface. | |||||||||
int | SCOPE_JAVASCRIPT_INTERFACE | Allow list scope for testing web view URLs before injected the Airship JS interface (native bridge). | |||||||||
int | SCOPE_OPEN_URL | Allow list scope for testing URLs before loading them in either a web view or deep linking to them externally from the app. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UrlAllowList() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
addEntry(String pattern, int scope)
Adds an entry to the URL allow list for URL matching.
| ||||||||||
boolean |
addEntry(String pattern)
Adds an entry to the URL allow list for URL matching.
| ||||||||||
boolean |
isAllowed(String url)
Checks if a given URL is allowed or not with scope
SCOPE_ALL . | ||||||||||
boolean |
isAllowed(String url, int scope)
Checks if a given URL is allowed or not.
| ||||||||||
void |
setUrlAllowListCallback(UrlAllowList.OnUrlAllowListCallback urlAllowListCallback)
Sets the urlAllowList callback.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
UrlAllowList entry applies to both url and JS interface.
Allow list scope for testing web view URLs before injected the Airship JS interface (native bridge).
Allow list scope for testing URLs before loading them in either a web view or deep linking to them externally from the app.
Adds an entry to the URL allow list for URL matching. Patterns must be defined with the following syntax:
<pattern> := '*' | <scheme>'://'<host>/<path> | <scheme>'://'<host> | <scheme>':/'<path> | <scheme>':///'<path>
<scheme> := <any char combination, '*' are treated as wild cards>
<host> := '*' | '*.'<any char combination except '/' and '*'> | <any char combination except '/' and '*'>
<path> := <any char combination, '*' are treated as wild cards>
Examples:
'*' will match any URI
'*://www.urbanairship.com' will match any schema from www.urbanairship.com
'https://*.urbanairship.com' will match any https URL from urbanairship.com and any of its subdomains.
'file:///android_asset/*' will match any file in the android assets directory.
'http://urbanairship.com/foo/*.html' will match any url from urbanairship.com that ends in .html
and the path starts with /foo/.
Note: International domains should add entries for both the ASCII and the unicode versions of the domain.
pattern | The URL pattern to add as a URL allow list matcher. |
---|---|
scope | The scope that entry applies to. |
true
if the pattern was added successfully, false
if the pattern
was unable to be added because it was either null or did not match the url-pattern syntax.
Adds an entry to the URL allow list for URL matching. Patterns must be defined with the following syntax:
<pattern> := '*' | <scheme>'://'<host>/<path> | <scheme>'://'<host> | <scheme>':/'<path> | <scheme>':///'<path> | <scheme>':'<path>
<scheme> := <any char combination ' ', '*' are treated as wild cards>
<host> := '*' | '*.'<any char combination except ' ', '/' and '*'> | <any char combination except ' ', '/', and '*'>
<path> := <any char combination except ' ', '*' are treated as wild cards>
Examples:
'*' will match any URI
'*://www.urbanairship.com' will match any schema from www.urbanairship.com
'https://*.urbanairship.com' will match any https URL from urbanairship.com and any of its subdomains.
'file:///android_asset/*' will match any file in the android assets directory.
'http://urbanairship.com/foo/*.html' will match any url from urbanairship.com that ends in .html
and the path starts with /foo/.
Note: International domains should add entries for both the ASCII and the unicode versions of the domain.
pattern | The URL pattern to add as a URL allow list matcher. |
---|
true
if the pattern was added successfully, false
if the pattern
was unable to be added because it was either null or did not match the url-pattern syntax.
Checks if a given URL is allowed or not with scope SCOPE_ALL
.
url | The URL. |
---|
true
If the URL matches any entries in the URL allow list.
Checks if a given URL is allowed or not.
url | The URL. |
---|---|
scope | The scope. |
true
If the URL matches any entries in the URL allow list.
Sets the urlAllowList callback.
urlAllowListCallback | The urlAllowList callback. |
---|