class AbstractHttpAccessAuditFilter implements Filter {

    @Override
    public Promise<Response, NeverThrowsException> filter(final Context context, final Request request, Handler next) {
        auditAccessAttempt(request, context);
        return next.handle(context, request).then(new Function<Response, Response, NeverThrowsException>() {
            @Override
            public Response apply(Response response) {
                if (response.getStatus().isSuccessful()) {
                    auditAccessSuccess(request, context, response);
                } else {
                    auditAccessFailure(request, context, response);
                }
                return response;
            }
        });
    }

    public  AbstractHttpAccessAuditFilter(Component component,
            AuditEventPublisher auditEventPublisher, AuditEventFactory auditEventFactory);

}