I'm using hibernate-validator with a JAX-RS service to validate query parameters using @NotNull
:
@GET
public Response doSomething(@NotNull @QueryParam("myParam") String myParam) {...}
This works as expected and throws a ConstraintViolationException
if myParam
is null
. I'd like to extract the param name which is associated to the violation (e.g. myParam
), and return that in the response message to the client but there does not appear to be an obvious way of extracting this from the exception. Can someone provide some insight?