matchAllUrls.setUrlPattern(".*");
return new RequestPatternBuilder(RequestMethod.ANY, matchAllUrls);
}
public RequestPattern build() {
RequestPattern requestPattern = new RequestPattern();
requestPattern.setMethod(method);
urlMatchingStrategy.contributeTo(requestPattern);
for (Map.Entry<String, ValueMatchingStrategy> header: headers.entrySet()) {
requestPattern.addHeader(header.getKey(), header.getValue().asValuePattern());
}
for (String key: withoutHeaders) {
requestPattern.addHeader(key, ValuePattern.absent());
}
for (Map.Entry<String, ValueMatchingStrategy> queryParam: queryParameters.entrySet()) {
requestPattern.addQueryParam(queryParam.getKey(), queryParam.getValue().asValuePattern());
}
if (!bodyPatterns.isEmpty()) {
requestPattern.setBodyPatterns(newArrayList(transform(bodyPatterns, toValuePattern)));
}
return requestPattern;
}