You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Gaetano Ciotola <ga...@gmail.com> on 2013/07/11 19:29:07 UTC

CXF JAX-RS - json validation.

Hi,
I have implemented a jax-rs web service, the request is exclusively JSON.
I would like to perform some request validation but I have no idea how to
proceed.

Any suggestion would be much appreciated

Thanks
 Gaetano

Re: CXF JAX-RS - json validation.

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 11/07/13 18:29, Gaetano Ciotola wrote:
> Hi,
> I have implemented a jax-rs web service, the request is exclusively JSON.
> I would like to perform some request validation but I have no idea how to
> proceed.
>
> Any suggestion would be much appreciated
>
If JSONProvider is used, try:

http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-Schemavalidation

It is also possible to customize XMLStreamReader which accepts the 
events from JSON reader and validate at that level

Sergey
> Thanks
>   Gaetano
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: CXF JAX-RS - json validation.

Posted by Thorsten Höger <li...@hoegernet.de>.
Hi,

thanks. I will write some documentation to ease the first steps with RESTAssert.


Am 12.07.2013 16:39, schrieb Sergey Beryozkin:
> I linked to REST Utilities project from the main wiki page, I added a 3rd party projects
> sub section, where we can link to projects of general interest
>
> Thanks, Sergey
> On 11/07/13 21:39, Sergey Beryozkin wrote:
>> Hi Thorsten
>>
>> I'll update the tests wiki page with this link
>>
>> Thanks, Sergey
>> On 11/07/13 21:35, Thorsten Höger wrote:
>>> Am 11.07.2013 19:29, schrieb Gaetano Ciotola:
>>>> Hi,
>>>> I have implemented a jax-rs web service, the request is exclusively
>>>> JSON.
>>>> I would like to perform some request validation but I have no idea
>>>> how to
>>>> proceed.
>>>>
>>>> Any suggestion would be much appreciated
>>>>
>>>> Thanks
>>>>   Gaetano
>>>>
>>> Hi,
>>>
>>> I had the same challenge and I wrote a utility class to do this.
>>> https://github.com/taimos/RESTUtils
>>>
>>> Just use the class RESTAssert, it throws WebApplicationExceptions on
>>> invalid data.
>>>
>>> The library is available via Maven Central
>>>
>>> Regards,
>>> Thorsten
>>>
>>
>
>


Re: CXF JAX-RS - json validation.

Posted by Sergey Beryozkin <sb...@gmail.com>.
I linked to REST Utilities project from the main wiki page, I added a 
3rd party projects sub section, where we can link to projects of general 
interest

Thanks, Sergey
On 11/07/13 21:39, Sergey Beryozkin wrote:
> Hi Thorsten
>
> I'll update the tests wiki page with this link
>
> Thanks, Sergey
> On 11/07/13 21:35, Thorsten Höger wrote:
>> Am 11.07.2013 19:29, schrieb Gaetano Ciotola:
>>> Hi,
>>> I have implemented a jax-rs web service, the request is exclusively
>>> JSON.
>>> I would like to perform some request validation but I have no idea
>>> how to
>>> proceed.
>>>
>>> Any suggestion would be much appreciated
>>>
>>> Thanks
>>>   Gaetano
>>>
>> Hi,
>>
>> I had the same challenge and I wrote a utility class to do this.
>> https://github.com/taimos/RESTUtils
>>
>> Just use the class RESTAssert, it throws WebApplicationExceptions on
>> invalid data.
>>
>> The library is available via Maven Central
>>
>> Regards,
>> Thorsten
>>
>



Re: CXF JAX-RS - json validation.

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Thorsten

I'll update the tests wiki page with this link

Thanks, Sergey
On 11/07/13 21:35, Thorsten Höger wrote:
> Am 11.07.2013 19:29, schrieb Gaetano Ciotola:
>> Hi,
>> I have implemented a jax-rs web service, the request is exclusively JSON.
>> I would like to perform some request validation but I have no idea how to
>> proceed.
>>
>> Any suggestion would be much appreciated
>>
>> Thanks
>>   Gaetano
>>
> Hi,
>
> I had the same challenge and I wrote a utility class to do this.
> https://github.com/taimos/RESTUtils
>
> Just use the class RESTAssert, it throws WebApplicationExceptions on invalid data.
>
> The library is available via Maven Central
>
> Regards,
> Thorsten
>


Re: CXF JAX-RS - json validation.

Posted by Thorsten Höger <li...@hoegernet.de>.
Am 11.07.2013 19:29, schrieb Gaetano Ciotola:
> Hi,
> I have implemented a jax-rs web service, the request is exclusively JSON.
> I would like to perform some request validation but I have no idea how to
> proceed.
>
> Any suggestion would be much appreciated
>
> Thanks
>  Gaetano
>
Hi,

I had the same challenge and I wrote a utility class to do this.
https://github.com/taimos/RESTUtils

Just use the class RESTAssert, it throws WebApplicationExceptions on invalid data.

The library is available via Maven Central

Regards,
Thorsten