[resteasy-dev] Disable validation for individual requests

Alessio Soldano asoldano at redhat.com
Thu Mar 22 12:50:44 EDT 2018


Great, thanks for having shared your result.

On Fri, Mar 16, 2018 at 5:46 PM, Christian Kaltepoth <christian at kaltepoth.de
> wrote:

> Hi all,
>
> answering my own question: I was able to disable the RESTEasy validation
> by creating a ContextResolver which returns a custom GeneralValidator.
>
> See the following code if you are interested in the details:
>
> https://github.com/mvc-spec/ozark/tree/0fb00bd912d63cbae032e5335ce74c
> 43ace3ea55/resteasy/src/main/java/org/mvcspec/ozark/resteasy/validation
>
> Christian
>
>
> Am Di., 6. März 2018 um 15:40 Uhr schrieb Christian Kaltepoth <
> christian at kaltepoth.de>:
>
>> Hey all,
>>
>> I'm currently working on Ozark, which is the reference implementation for
>> JSR-371 (MVC 1.0). My current focus is to improve the integration between
>> Ozark and RESTEasy.
>>
>> The MVC specification has some special requirements regarding validation.
>> Especially it requires that resource methods (called controller methods in
>> MVC) get executed even if validation errors were detected according to the
>> Bean Validation annotation places on resource properties and resource
>> method parameters. This is required so that the controller can handle these
>> errors, which most typically varies between pages.
>>
>> To achieve this, Ozark currently implements a custom validation layer
>> without relying on the native JAX-RS validation which (by design) aborts
>> request processing as soon as validation errors are detected. This
>> basically works fine, but it currently forces users to manually disable the
>> native JAX-RS validation by annotating controllers with
>> @ValidateOnExecution(NONE). Of course this isn't very user friendly, so I'm
>> looking for ways to work around this.
>>
>> So I'm looking for ways to disable the validation on a per request basis.
>> It is important to do this only for individual requests because this
>> behavior most only be applied if the request is processed by a MVC
>> controller. Regular JAX-RS resources must not be affected by this.
>>
>> Of course I would love to find a way to make this work with current
>> RESTEasy versions. But I would also be happy to contribute code if you
>> think that some kind of SPI makes sense.
>>
>> Christian
>>
>>
>> --
>> Christian Kaltepoth
>> Blog: http://blog.kaltepoth.de/
>> Twitter: http://twitter.com/chkal
>> GitHub: https://github.com/chkal
>>
>>
>
> --
> Christian Kaltepoth
> Blog: http://blog.kaltepoth.de/
> Twitter: http://twitter.com/chkal
> GitHub: https://github.com/chkal
>
>
> _______________________________________________
> resteasy-dev mailing list
> resteasy-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/resteasy-dev
>
>


-- 

Alessio Soldano

Associate Manager

Red Hat

<https://www.redhat.com>
<https://red.ht/sig>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/resteasy-dev/attachments/20180322/0cf838d9/attachment.html 


More information about the resteasy-dev mailing list