Package org.glassfish.jersey.server.spi
Interface ValidationInterceptor
-
@Contract public interface ValidationInterceptor
Interceptor for method validation processing. Allows to override the default Jersey behaviour. By default, the Jersey runtime throws aValidationException
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.
- Since:
- 2.18
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onValidate(ValidationInterceptorContext context)
Used to intercept resource method validation processing.
-
-
-
Method Detail
-
onValidate
void onValidate(ValidationInterceptorContext context) throws javax.validation.ValidationException
Used to intercept resource method validation processing. To allow further validation processing, every and each implementation must invokeValidationInterceptorContext.proceed()
method.- Parameters:
context
- method validation context.- Throws:
javax.validation.ValidationException
- in case the validation exception should be thrown as a result of the validation processing.
-
-