public final class UrlRegexRequestMatcher extends Object implements WebRequestMatcher
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(Pattern pattern) |
UrlRegexRequestMatcher(String regex) |
Modifier and Type | Method and Description |
---|---|
boolean |
matches(com.gargoylesoftware.htmlunit.WebRequest request)
Whether this matcher matches on the supplied web request.
|
public UrlRegexRequestMatcher(String regex)
public UrlRegexRequestMatcher(Pattern pattern)
public boolean matches(com.gargoylesoftware.htmlunit.WebRequest request)
WebRequestMatcher
matches
in interface WebRequestMatcher
request
- the WebRequest
to attempt to match ontrue
if this matcher matches on the WebRequest