You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by nino martinez wael <ni...@gmail.com> on 2017/11/29 07:51:02 UTC
CXF 3.2.1 JAX RS and bean validation
Hi are there anyway to setup so the response vill give a more verbose
output when validation fails?
Currently when my validation fails, all constraints are printed in the
server log with details, but the client just receive a 400 bad request..
Would be very nice for the client a little more detail on what went wrong..
--
Best regards / Med venlig hilsen
Nino Martinez
Re: CXF 3.2.1 JAX RS and bean validation
Posted by nino martinez wael <ni...@gmail.com>.
Cool thanks a lot:)
On Wed, Nov 29, 2017 at 2:03 PM, Sergey Beryozkin <sb...@gmail.com>
wrote:
> It has an optional addMessageToResponse property,
>
> and you can always customize, example, as David suggested, create your own
> mapper, may be it will just extend ValidationExceptionMapper and set its
> addMessageToResponse to true, etc
>
> Cheers, Sergey
>
> On 29/11/17 09:17, nino martinez wael wrote:
>
>> I would think that was exactly what
>> org.apache.cxf.jaxrs.validation.ValidationExceptionMapper
>> did?
>>
>>
>> regards Nino
>>
>> On Wed, Nov 29, 2017 at 9:10 AM, David Karlsen <da...@gmail.com>
>> wrote:
>>
>> You could maybe implement an ExceptionMapper to handle them and transform
>>> over to the wanted output format:
>>> https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/Excepti
>>> onMapper.html
>>> https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-
>>> 0-2rd-edition/en/part1/chapter7/exception_handling.html
>>>
>>>
>>> 2017-11-29 8:51 GMT+01:00 nino martinez wael <
>>> nino.martinez.wael@gmail.com
>>>
>>>> :
>>>>
>>>
>>> Hi are there anyway to setup so the response vill give a more verbose
>>>> output when validation fails?
>>>>
>>>> Currently when my validation fails, all constraints are printed in the
>>>> server log with details, but the client just receive a 400 bad request..
>>>>
>>>> Would be very nice for the client a little more detail on what went
>>>>
>>> wrong..
>>>
>>>>
>>>> --
>>>> Best regards / Med venlig hilsen
>>>> Nino Martinez
>>>>
>>>>
>>>
>>>
>>> --
>>> --
>>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>>
>>>
>>
>>
>>
--
Best regards / Med venlig hilsen
Nino Martinez
Re: CXF 3.2.1 JAX RS and bean validation
Posted by Sergey Beryozkin <sb...@gmail.com>.
It has an optional addMessageToResponse property,
and you can always customize, example, as David suggested, create your
own mapper, may be it will just extend ValidationExceptionMapper and set
its addMessageToResponse to true, etc
Cheers, Sergey
On 29/11/17 09:17, nino martinez wael wrote:
> I would think that was exactly what
> org.apache.cxf.jaxrs.validation.ValidationExceptionMapper
> did?
>
>
> regards Nino
>
> On Wed, Nov 29, 2017 at 9:10 AM, David Karlsen <da...@gmail.com>
> wrote:
>
>> You could maybe implement an ExceptionMapper to handle them and transform
>> over to the wanted output format:
>> https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/ExceptionMapper.html
>> https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-
>> 0-2rd-edition/en/part1/chapter7/exception_handling.html
>>
>>
>> 2017-11-29 8:51 GMT+01:00 nino martinez wael <nino.martinez.wael@gmail.com
>>> :
>>
>>> Hi are there anyway to setup so the response vill give a more verbose
>>> output when validation fails?
>>>
>>> Currently when my validation fails, all constraints are printed in the
>>> server log with details, but the client just receive a 400 bad request..
>>>
>>> Would be very nice for the client a little more detail on what went
>> wrong..
>>>
>>> --
>>> Best regards / Med venlig hilsen
>>> Nino Martinez
>>>
>>
>>
>>
>> --
>> --
>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>
>
>
>
Re: CXF 3.2.1 JAX RS and bean validation
Posted by nino martinez wael <ni...@gmail.com>.
I would think that was exactly what
org.apache.cxf.jaxrs.validation.ValidationExceptionMapper
did?
regards Nino
On Wed, Nov 29, 2017 at 9:10 AM, David Karlsen <da...@gmail.com>
wrote:
> You could maybe implement an ExceptionMapper to handle them and transform
> over to the wanted output format:
> https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/ExceptionMapper.html
> https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-
> 0-2rd-edition/en/part1/chapter7/exception_handling.html
>
>
> 2017-11-29 8:51 GMT+01:00 nino martinez wael <nino.martinez.wael@gmail.com
> >:
>
> > Hi are there anyway to setup so the response vill give a more verbose
> > output when validation fails?
> >
> > Currently when my validation fails, all constraints are printed in the
> > server log with details, but the client just receive a 400 bad request..
> >
> > Would be very nice for the client a little more detail on what went
> wrong..
> >
> > --
> > Best regards / Med venlig hilsen
> > Nino Martinez
> >
>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
--
Best regards / Med venlig hilsen
Nino Martinez
Re: CXF 3.2.1 JAX RS and bean validation
Posted by David Karlsen <da...@gmail.com>.
You could maybe implement an ExceptionMapper to handle them and transform
over to the wanted output format:
https://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/ExceptionMapper.html
https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-0-2rd-edition/en/part1/chapter7/exception_handling.html
2017-11-29 8:51 GMT+01:00 nino martinez wael <ni...@gmail.com>:
> Hi are there anyway to setup so the response vill give a more verbose
> output when validation fails?
>
> Currently when my validation fails, all constraints are printed in the
> server log with details, but the client just receive a 400 bad request..
>
> Would be very nice for the client a little more detail on what went wrong..
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez
>
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen