Class ConstraintMessage

java.lang.Object
io.dropwizard.jersey.validation.ConstraintMessage

public class ConstraintMessage extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends jakarta.validation.ConstraintViolation<?>>
    int
    determineStatus(Set<T> violations, org.glassfish.jersey.server.model.Invocable invocable)
    Given a set of constraint violations and a Jersey Invocable where the constraint occurred, determine the HTTP Status code for the response.
    static String
    getMessage(jakarta.validation.ConstraintViolation<?> v, org.glassfish.jersey.server.model.Invocable invocable)
    Gets the human friendly location of where the violation was raised.
    isRequestEntity(jakarta.validation.ConstraintViolation<?> violation, org.glassfish.jersey.server.model.Invocable invocable)
    Determines if constraint violation occurred in the request entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getMessage

      public static String getMessage(jakarta.validation.ConstraintViolation<?> v, org.glassfish.jersey.server.model.Invocable invocable)
      Gets the human friendly location of where the violation was raised.
    • isRequestEntity

      public static Optional<String> isRequestEntity(jakarta.validation.ConstraintViolation<?> violation, org.glassfish.jersey.server.model.Invocable invocable)
      Determines if constraint violation occurred in the request entity. If it did, return a client friendly string representation of where the error occurred (e.g. "patient.name")
    • determineStatus

      public static <T extends jakarta.validation.ConstraintViolation<?>> int determineStatus(Set<T> violations, org.glassfish.jersey.server.model.Invocable invocable)
      Given a set of constraint violations and a Jersey Invocable where the constraint occurred, determine the HTTP Status code for the response. A return value violation is an internal server error, an invalid request body is unprocessable entity, and any params that are invalid means a bad request