public static String create(String message) { return create(message, null); }
public static String create(String message, Consumer<OutputWriter> json) { return new MessageJson(message, json).toString(); }
protected String messageJson(String message) { return MessageJson.create(message); }
public static HaltException haltBecauseOfReason(String message, Object... tokens) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(format(message, tokens))); } }
public static HaltException haltBecauseNotFound(String message, Object... tokens) { return halt(HttpStatus.NOT_FOUND.value(), MessageJson.create(format(message, tokens))); }
public static HaltException haltBecauseEtagDoesNotMatch(String message, Object... tokens) { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create(format(message, tokens))); }
public static HaltException haltBecauseEtagDoesNotMatch() { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create("Someone has modified the entity. Please update your copy with the changes and try again.")); }
public static HaltException haltBecauseMissingJsonProperty(String property, JsonObject jsonObject) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(missingJsonProperty(property, jsonObject))); }
public static HaltException haltBecauseNotFound() { return halt(HttpStatus.NOT_FOUND.value(), MessageJson.create(notFoundMessage())); }
public static HaltException haltBecauseEntityAlreadyExists(Consumer<OutputWriter> jsonInRequestBody, String entityType, Object existingName) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(entityAlreadyExistsMessage(entityType, existingName), jsonInRequestBody)); }
public static HaltException haltBecausePropertyIsNotAJsonObject(String property, JsonObject jsonObject) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(propertyIsNotAJsonObject(property, jsonObject))); }
public static HaltException haltBecauseRequiredParamMissing(String paramName) { return halt(HttpStatus.BAD_REQUEST.value(), MessageJson.create(missingRequestParameter(paramName))); }
public static HaltException haltBecauseDeprecatedConfirmHeaderMissing() { return halt(HttpStatus.BAD_REQUEST.value(), MessageJson.create(deprecatedConfirmHeaderMissing())); }
public static HaltException haltBecauseForbidden() { return halt(HttpStatus.FORBIDDEN.value(), MessageJson.create(forbiddenMessage())); }
public static HaltException haltBecauseRateLimitExceeded() { return halt(HttpStatus.TOO_MANY_REQUESTS.value(), MessageJson.create(rateLimitExceeded())); }
public static HaltException haltBecauseJsonContentTypeExpected() { return halt(HttpStatus.UNSUPPORTED_MEDIA_TYPE.value(), MessageJson.create(jsonContentTypeExpected())); }
public static HaltException haltBecausePropertyIsNotAJsonArray(String property, JsonObject jsonObject) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(propertyIsNotAJsonArray(property, jsonObject))); }
public static HaltException haltBecauseRenameOfEntityIsNotSupported(String entityType) { return halt(HttpStatus.UNPROCESSABLE_ENTITY.value(), MessageJson.create(renameOfEntityIsNotSupportedMessage(entityType))); }
public static HaltException haltBecauseEtagDoesNotMatch(String entityType, CaseInsensitiveString name) { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create(etagDoesNotMatch(entityType, name))); }
public static HaltException haltBecauseEtagDoesNotMatch(String entityType, String name) { return halt(HttpStatus.PRECONDITION_FAILED.value(), MessageJson.create(etagDoesNotMatch(entityType, name))); }