spring-framework / org.springframework.test.web.servlet.htmlunit / UrlRegexRequestMatcher

UrlRegexRequestMatcher

class UrlRegexRequestMatcher : WebRequestMatcher

A 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/.*"); 

Author
Rob Winch

Author
Sam Brannen

Since
4.2

See Also
org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection

Constructors

<init>

UrlRegexRequestMatcher(regex: String)
UrlRegexRequestMatcher(pattern: Pattern)

Functions

matches

fun matches(request: WebRequest): Boolean