Answer the question
In order to leave comments, you need to log in
Is it possible to change the output of @NotNull from "text/plain" to "application/json" in JAX-RS?
Let's say we have a JAX-RS REST service with the following method:
The member parameter is validated against null using the NotNull annotation . If you make a POST request with an empty body, the server will return a 400 response, which is logical, but in the response body it writes automatically generated additional error information in text/plain format.
Actually the question is, is it possible to change the format of the generated information to JSON and how to do it? Why does it basically return text/plain by default, and not what is specified in the parameters of the Produces annotation to the method?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question