public static HaltException haltBecauseConfirmHeaderMissing() { return halt(HttpStatus.BAD_REQUEST.value(), MessageJson.create(confirmHeaderMissing())); }
public static HaltException haltBecauseDeprecatedConfirmHeaderMissing() { return halt(HttpStatus.BAD_REQUEST.value(), MessageJson.create(deprecatedConfirmHeaderMissing())); }
public static HaltException haltBecauseEntityAlreadyExists(Consumer<OutputWriter> jsonInRequestBody, String entityType, Object existingName) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(entityAlreadyExistsMessage(entityType, existingName), jsonInRequestBody)); }
@Override public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", this::verifyContentType); before("/*", this::verifyContentType); before("", mimeType, apiAuthenticationHelper::checkAnyAdminUserAnd403); before("/*", mimeType, apiAuthenticationHelper::checkAnyAdminUserAnd403); before("", mimeType, this::checkRateLimitAvailable); post("", mimeType, this::encrypt); exception(CryptoException.class, (CryptoException exception, Request request, Response response) -> { response.status(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.body(MessageJson.create(HaltApiMessages.errorWhileEncryptingMessage())); }); }); }
public static String etagDoesNotMatch(String entityType, CaseInsensitiveString name) { return etagDoesNotMatch(entityType, name.toString()); }
public static HaltException haltBecauseNotFound() { return halt(HttpStatus.NOT_FOUND.value(), MessageJson.create(notFoundMessage())); }
public static HaltException haltBecauseMissingJsonProperty(String property, JsonObject jsonObject) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(missingJsonProperty(property, jsonObject))); }
public static HaltException haltBecauseRequiredParamMissing(String paramName) { return halt(HttpStatus.BAD_REQUEST.value(), MessageJson.create(missingRequestParameter(paramName))); }
public static HaltException haltBecauseForbidden() { return halt(HttpStatus.FORBIDDEN.value(), MessageJson.create(forbiddenMessage())); }
public static HaltException haltBecauseJsonContentTypeExpected() { return halt(HttpStatus.UNSUPPORTED_MEDIA_TYPE.value(), MessageJson.create(jsonContentTypeExpected())); }
@Override public void setupRoutes() { path(controllerPath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", this::verifyContentType); before("/*", this::verifyContentType); before(Routes.Pipeline.PAUSE_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403); before(Routes.Pipeline.UNPAUSE_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403); before(Routes.Pipeline.UNLOCK_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403); before(Routes.Pipeline.TRIGGER_OPTIONS_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403); before(Routes.Pipeline.SCHEDULE_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403); post(Routes.Pipeline.PAUSE_PATH, mimeType, this::pause); post(Routes.Pipeline.UNPAUSE_PATH, mimeType, this::unpause); post(Routes.Pipeline.UNLOCK_PATH, mimeType, this::unlock); get(Routes.Pipeline.TRIGGER_OPTIONS_PATH, mimeType, this::triggerOptions); post(Routes.Pipeline.SCHEDULE_PATH, mimeType, this::schedule); exception(RecordNotFoundException.class, this::notFound); exception(InvalidGoCipherTextRuntimeException.class, (InvalidGoCipherTextRuntimeException exception, Request request, Response response) -> { response.status(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.body(MessageJson.create(HaltApiMessages.errorWhileEncryptingMessage())); }); }); }
public static HaltException haltBecauseEtagDoesNotMatch(String entityType, CaseInsensitiveString name) { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create(etagDoesNotMatch(entityType, name))); }
default void notFound(Exception ex, Request req, Response res) { res.status(HttpStatus.NOT_FOUND.value()); res.body(MessageJson.create(notFoundMessage())); }
public static HaltException haltBecauseEtagDoesNotMatch(String entityType, String name) { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create(etagDoesNotMatch(entityType, name))); }