public class GetRequestCountTask implements AdminTask {
@Override
public ResponseDefinition execute(Admin admin, Request request) {
RequestPattern requestPattern = buildRequestPatternFrom(request.getBodyAsString());
VerificationResult result = admin.countRequestsMatching(requestPattern);
ResponseDefinition response = new ResponseDefinition(HTTP_OK, write(result));
response.setHeaders(new HttpHeaders(httpHeader("Content-Type", "application/json")));
return response;
}