1
I need a help from you. I am creating a web service in java using jersey and Ibernate. To validate the fields informed by who calls the service I used for one of the fields the JPA @Pattern annotation, as below:
@XmlRootElement
public class Cfop {
@Pattern(regexp = "[0-9]+", message = "{cfop.idCfop.pattern}")
private String idCfop;
...
The message {cfop.idCfop.Pattern} is defined in my Validationmessages.properties file as follows:
cfop.idCfop.pattern = Id ${validatedValue} inv\u00e1lido.
And in my controller, I have:
@Path(Constante.CFOP_SERVICE_ENDPOINT)
public class CfopController {
private final CfopRepository repository = new CfopRepository();
@POST
@Consumes("application/json; charset=UTF-8")
@Produces("text/plain; charset=UTF-8")
public Response Cadastrar(@Valid Cfop cfop){
When I call my service via Postman, it prints the right message, however it shows tbm a default message, which I don’t want to be displayed, as follows:
Id 123s inválido. (path = CfopController.Cadastrar.arg0.idCfop, invalidValue = 123s)
It is possible to delete this message: (path = Cfopcontroller.Cadastrar.arg0.idCfop, invalidValue = 123s) ?
Note: In my web.xml I have:
<init-param>
<param-ame>jersey.config.beanValidation.enableOutputValidationErrorEntity.server</param-name>
<param-value>true</param-value>
</init-param>