public class

Whitelist

extends Object
java.lang.Object
   ↳ com.urbanairship.js.Whitelist

Class Overview

Defines a set of URL patterns to match a URL.

Summary

Public Constructors
Whitelist()
Public Methods
boolean addEntry(String pattern)
Adds an entry to the whitelist for URL matching.
boolean isWhitelisted(String url)
Checks if a given URL is whitelisted or not.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Whitelist ()

Public Methods

public boolean addEntry (String pattern)

Adds an entry to the whitelist for URL matching. Patterns must be defined with the following syntax:

 <pattern> := '*' | <scheme>'://'<host><path> | <scheme>'://'<host> | 'file://'<path>
 <scheme> := '*' | 'http' | 'https'
 <host> := '*' | '*.'<any char except '/' and '*'>+ | <any char except '/' and '*'>+
 <path> := '/'<any char>
 

 Examples:

  '*' will match any file, http, or https URL.
  '*://www.urbanairship.com' will match any file, http, or https URL 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 an entry for both the ASCII and the unicode versions of the domain.

Parameters
pattern The URL pattern to add as a whitelist matcher.
Returns
  • 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.

public boolean isWhitelisted (String url)

Checks if a given URL is whitelisted or not.

Parameters
url The URL.
Returns
  • true If the URL matches any entries in the whitelist.