@Contract public interface ValidationInterceptor
ValidationException
or one of its subclasses,
that gets mapped to a HTTP 400 response, if any validation issues occur. In such case
the actual resource method does not get invoked at all.
Validation interceptor implementation allows to e.g. swallow the ConstraintViolationException
and handle the validation issues in the resource method. It is also possible to tweak
validated components. This could be utilized in case of proxied resources,
when field validation is not possible on a dynamic proxy, and the validator requires
the original delegated instance.
Each validation interceptor implementation must invoke proceed method on provided interceptor context as part of interception processing.
Modifier and Type | Method and Description |
---|---|
void |
onValidate(ValidationInterceptorContext context)
Used to intercept resource method validation processing.
|
void onValidate(ValidationInterceptorContext context) throws jakarta.validation.ValidationException
ValidationInterceptorContext.proceed()
method.context
- method validation context.jakarta.validation.ValidationException
- in case the validation exception should be thrown as a result of the validation processing.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.