/** * Records an 'access' audit event before and after the filtered CREST resource receives an action * request. * * <p>If the 'before' audit event fails due to an error, the request is cancelled and an error * response is returned. If the 'after' audit event fails due to an error, the request is not * cancelled as it's affects may have already been applied. * * @param context {@inheritDoc} * @param request {@inheritDoc} * @param next {@inheritDoc} */ @Override public Promise<ActionResponse, ResourceException> filterAction( Context context, ActionRequest request, RequestHandler next) { final AuditingResultHandler auditingHandler = newAuditingResultHandler(context, request); try { auditingHandler.auditAccessAttempt(); } catch (AuditException e) { return newExceptionPromise(ResourceException.getException(ResourceException.INTERNAL_ERROR)); } return auditResponse(next.handleAction(context, request), auditingHandler); }
/** * Records an 'access' audit event before and after the filtered CREST resource receives an action * request. * * <p>If the 'before' audit event fails due to an error, the request is cancelled and an error * response is returned. If the 'after' audit event fails due to an error, the request is not * cancelled as it's affects may have already been applied. * * @param context {@inheritDoc} * @param request {@inheritDoc} * @param handler {@inheritDoc} * @param next {@inheritDoc} */ @Override public void filterAction( ServerContext context, ActionRequest request, ResultHandler<JsonValue> handler, RequestHandler next) { AuditingResultHandler<JsonValue> auditingHandler = newAuditingResultHandler(context, request, handler); try { auditingHandler.auditAccessAttempt(); } catch (AuditException e) { handler.handleError(ResourceException.getException(ResourceException.INTERNAL_ERROR)); return; } next.handleAction(context, request, auditingHandler); }