public final class UrlRegexRequestMatcher extends java.lang.Object implements WebRequestMatcher
An implementation of WebRequestMatcher that allows matching on WebRequest#getUrl().toExternalForm() using a regular expression. For example, if you would like to match on the domain code.jquery.com, you might want to use the following:
WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");
DelegatingWebConnection
Constructor and Description |
---|
UrlRegexRequestMatcher(java.util.regex.Pattern pattern) |
UrlRegexRequestMatcher(java.lang.String regex) |
Modifier and Type | Method and Description |
---|---|
boolean |
matches(com.gargoylesoftware.htmlunit.WebRequest request)
Return true if matches on WebRequest, else false
|
public UrlRegexRequestMatcher(java.lang.String regex)
public UrlRegexRequestMatcher(java.util.regex.Pattern pattern)
public boolean matches(com.gargoylesoftware.htmlunit.WebRequest request)
WebRequestMatcher
matches
in interface WebRequestMatcher
request
- the WebRequest to attempt to match on