public class Whitelist
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Whitelist |
WHITELIST_DISABLED
A disabled Whitelist.
|
| Constructor and Description |
|---|
Whitelist()
Creates an empty, disabled Whitelist.
|
Whitelist(java.util.Collection<java.lang.String> patterns,
int statusCode)
Creates a whitelist for the specified patterns, returning the given statusCode when a URL does not match one of the patterns.
|
Whitelist(int statusCode)
Creates an empty, enabled whitelist with the specified response code.
|
Whitelist(java.lang.String[] patterns,
int statusCode)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<java.util.regex.Pattern> |
getPatterns() |
int |
getResponseCode()
Deprecated.
use
getStatusCode() |
int |
getStatusCode() |
boolean |
isEnabled() |
boolean |
matches(java.lang.String url)
Returns true if the specified URL matches a whitelisted URL regular expression.
|
public static final Whitelist WHITELIST_DISABLED
public Whitelist()
public Whitelist(int statusCode)
statusCode - the response code that the (enabled) Whitelist will return for all URLs.@Deprecated
public Whitelist(java.lang.String[] patterns,
int statusCode)
Whitelist(java.util.Collection, int)patterns - String[] patternsstatusCode - int statusCodepublic Whitelist(java.util.Collection<java.lang.String> patterns,
int statusCode)
patterns - URL-matching regular expression patterns to whiteliststatusCode - the HTTP status code to return when a request URL matches a whitelist patternpublic boolean isEnabled()
public java.util.Collection<java.util.regex.Pattern> getPatterns()
public int getStatusCode()
@Deprecated public int getResponseCode()
getStatusCode()public boolean matches(java.lang.String url)
url - URL to match against the whitelist