类 HostRequestMatcher
java.lang.Object
cn.taketoday.test.web.servlet.htmlunit.HostRequestMatcher
- 所有已实现的接口:
WebRequestMatcher
A
WebRequestMatcher that allows matching on the host and optionally
the port of WebRequest#getUrl().
For example, the following would match any request to the host
"code.jquery.com" without regard for the port.
WebRequestMatcher cdnMatcher = new HostMatcher("code.jquery.com");
Multiple hosts can also be passed in. For example, the following would
match any request to the host "code.jquery.com" or the host
"cdn.com" without regard for the port.
WebRequestMatcher cdnMatcher = new HostMatcher("code.jquery.com", "cdn.com");
Alternatively, one can also specify the port. For example, the following would match
any request to the host "code.jquery.com" with the port of 80.
WebRequestMatcher cdnMatcher = new HostMatcher("code.jquery.example:80");
The above cdnMatcher would match "http://code.jquery.example/jquery.js"
which has a default port of 80 and "http://code.jquery.example:80/jquery.js".
However, it would not match "https://code.jquery.example/jquery.js"
which has a default port of 443.
- 从以下版本开始:
- 4.0
- 作者:
- Rob Winch, Sam Brannen
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明HostRequestMatcher(String... hosts) Create a newHostRequestMatcherfor the given hosts — for example:"localhost","example.com:443", etc. -
方法概要
修饰符和类型方法说明booleanmatches(org.htmlunit.WebRequest request) Whether this matcher matches on the supplied web request.
-
字段详细资料
-
hosts
-
-
构造器详细资料
-
HostRequestMatcher
Create a newHostRequestMatcherfor the given hosts — for example:"localhost","example.com:443", etc.- 参数:
hosts- the hosts to match on
-
-
方法详细资料
-
matches
public boolean matches(org.htmlunit.WebRequest request) 从接口复制的说明:WebRequestMatcherWhether this matcher matches on the supplied web request.- 指定者:
matches在接口中WebRequestMatcher- 参数:
request- theWebRequestto attempt to match on- 返回:
trueif this matcher matches on theWebRequest
-