tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Goldsmith <sgj...@gmail.com>
Subject Re: Jaxrs Bean Validation
Date Thu, 12 May 2016 13:59:05 GMT
Or catch the exception and place it in an exception field in your entity.
Then it comes back in your payload in a member variable. In my case I map
the errors to HTTP status codes for this particular project to match an
existing client contract:

response =
Response.status(mapReturnCode(retCustStbDto.getException())).entity(retCustStbDto).build();

On Thu, May 12, 2016 at 2:41 AM, Romain Manni-Bucau <rmannibucau@gmail.com>
wrote:

> Hi,
>
> in conf/system.properties set "
> org.apache.cxf.jaxrs.validation.ValidationExceptionMapper.activated=false"
> and
> implement your own ExceptionMapper for bval exceptions.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-05-12 5:35 GMT+02:00 ravi sankar <sankar_ravi_c@yahoo.co.in.invalid>:
>
> > Hi Team,
> >     @GET
> >     @Path("hello1/{pnr}")
> >     @Produces(MediaType.TEXT_PLAIN)
> >     public String sayHello(                            @Size(min=6,
> max=6,
> > message="Check the Size")
> >                             @Pattern(regexp="[A-Za-z0-9\\-]+$",
> > message="Not a valid PNR")
> >                             @PathParam("pnr") String pnr) {
> >         return "PNR";
> >     }if I give the input as /hello1/$$$$$$
> > Returns http status 400 bad request and prints an error
> > HelloWorldResource.sayHello.arg0: "Not a valid PNR" in the tomee log
> > Is it possible to return the message "Not a valid PNR"  in the response
> > body along with http status code of 400.
> >  I believe  I am requesting a new feature to be added to tomee.
> > Thanks,Ravisankar Challa
> >
>



-- 
Steven P. Goldsmith

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message