You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Tobias Erdle <to...@gmail.com> on 2020/08/21 12:52:51 UTC

Intercept Bean Validation for custom handling

Hi all,

for the CXF integration of the  Jakarta EE MVC API reference
implementation, I need to intercept the Bean Validation mechanism of CXF,
so the MVC mechanism can work. This is necessary, because instead of
throwing an exception, we need to give the user a chance to handle the
invalid form submission in the controller logic. The other JAX-RS
implementations provide interfaces like Jersey's "ValidationInterceptor" to
intercept the validation mechanism, but unfortunately I could not find
anything similar in CXF.

So in practice, this is the the logic I need:

Request comes in -> Is requested resource annotated with @Controller?

-> YES: Ignore this request for Bean Validation
-> NO: Perform default validation

It would be really great if someone has an idea how I can achieve this
behavior with CXF, so the MVC API validation works on CXF as well as it
does on the other implementations.

Thanks in advance,

Tobias Erdle