Class ConstraintMessage


  • public class ConstraintMessage
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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.
      static Optional<String> isRequestEntity​(jakarta.validation.ConstraintViolation<?> violation, org.glassfish.jersey.server.model.Invocable invocable)
      Determines if constraint violation occurred in the request entity.
    • Method Detail

      • 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 (eg. "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