ResponseStatusException that is also MethodValidationResult.
Raised by HandlerMethodValidator in case of method validation errors
on a web controller method.
The getStatusCode() is 400 for input validation errors, and 500
for validation errors on a return value.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | HandlerMethodValidationException.Visitor
Contract to handle validation results with callbacks by controller method
parameter type, with |
| Modifier and Type | Field and Description |
|---|---|
| private final Predicate | |
| private final Predicate | |
| private final MethodValidationResult |
| Access | Constructor and Description |
|---|---|
| public | |
| public | HandlerMethodValidationException(MethodValidationResult validationResult, Predicate<MethodParameter> modelAttributePredicate, Predicate<MethodParameter> requestParamPredicate)
|
| modelAttributePredicate | back to summary |
|---|---|
| private final Predicate<MethodParameter> modelAttributePredicate | |
| requestParamPredicate | back to summary |
|---|---|
| private final Predicate<MethodParameter> requestParamPredicate | |
| validationResult | back to summary |
|---|---|
| private final MethodValidationResult validationResult | |
| HandlerMethodValidationException | back to summary |
|---|---|
| public HandlerMethodValidationException(MethodValidationResult validationResult) | |
| HandlerMethodValidationException | back to summary |
|---|---|
| public HandlerMethodValidationException(MethodValidationResult validationResult, Predicate<MethodParameter> modelAttributePredicate, Predicate<MethodParameter> requestParamPredicate) | |
| asErrors | back to summary |
|---|---|
| private static ParameterErrors asErrors(ParameterValidationResult result) | |
| getAllValidationResults | back to summary |
|---|---|
| public List Implements org. Doc from org. Return all validation results. This includes both method parameters with errors directly on them, and Object method parameters with nested errors on their fields and properties.
| |
| getDetailMessageArguments | back to summary |
|---|---|
| public Object[] getDetailMessageArguments(MessageSource messageSource, Locale locale) Overrides default org. Doc from org. Variant of This is useful for example to expand message codes from validation errors. The default implementation delegates to
| |
| getDetailMessageArguments | back to summary |
|---|---|
| public Object[] getDetailMessageArguments() Overrides org. Overrides default org. Doc from org. Return arguments to use along with a
| |
| getMethod | back to summary |
|---|---|
| public Method getMethod() Implements org. Doc from org. Return the method to which validation was applied.
| |
| getTarget | back to summary |
|---|---|
| public Object getTarget() Implements org. Doc from org. Return the target of the method invocation to which validation was applied.
| |
| initHttpStatus | back to summary |
|---|---|
| private static HttpStatus initHttpStatus(MethodValidationResult validationResult) | |
| isForReturnValue | back to summary |
|---|---|
| public boolean isForReturnValue() Implements org. Doc from org. Whether the violations are for a return value. If true the violations are from validating a return value. If false the violations are from validating method arguments.
| |
| visitResults | back to summary |
|---|---|
| public void visitResults(HandlerMethodValidationException. Provide a | |
other serving as the fallthrough.
| Modifier and Type | Method and Description |
|---|---|
| public void | cookieValue(CookieValue
the annotation declared on the parameter cookieValue, ParameterValidationResult the validation result result)Handle results for |
| public void | matrixVariable(MatrixVariable
the annotation declared on the parameter matrixVariable, ParameterValidationResult the validation result result)Handle results for |
| public void | modelAttribute(ModelAttribute
the optional modelAttribute, ParameterErrors ModelAttribute annotation,
possibly null if the method parameter is declared without it.the validation errors errors)Handle results for |
| public void | other(ParameterValidationResult
the validation result result)Handle other results that aren't any of the above. |
| public void | pathVariable(PathVariable
the annotation declared on the parameter pathVariable, ParameterValidationResult the validation result result)Handle results for |
| public void | requestBody(RequestBody
the annotation declared on the parameter requestBody, ParameterErrors the validation error errors)Handle results for |
| public void | requestHeader(RequestHeader
the annotation declared on the parameter requestHeader, ParameterValidationResult the validation result result)Handle results for |
| public void | requestParam(RequestParam
the optional requestParam, ParameterValidationResult RequestParam annotation,
possibly null if the method parameter is declared without it.the validation result result)Handle results for |
| public void | requestPart(RequestPart
the annotation declared on the parameter requestPart, ParameterErrors the validation errors errors)Handle results for |
| cookieValue | back to summary |
|---|---|
| public void cookieValue(CookieValue cookieValue, ParameterValidationResult result) Handle results for
| |
| matrixVariable | back to summary |
|---|---|
| public void matrixVariable(MatrixVariable matrixVariable, ParameterValidationResult result) Handle results for
| |
| modelAttribute | back to summary |
|---|---|
| public void modelAttribute(ModelAttribute modelAttribute, ParameterErrors errors) Handle results for
| |
| other | back to summary |
|---|---|
| public void other(ParameterValidationResult result) Handle other results that aren't any of the above.
| |
| pathVariable | back to summary |
|---|---|
| public void pathVariable(PathVariable pathVariable, ParameterValidationResult result) Handle results for
| |
| requestBody | back to summary |
|---|---|
| public void requestBody(RequestBody requestBody, ParameterErrors errors) Handle results for
| |
| requestHeader | back to summary |
|---|---|
| public void requestHeader(RequestHeader requestHeader, ParameterValidationResult result) Handle results for
| |
| requestParam | back to summary |
|---|---|
| public void requestParam(RequestParam requestParam, ParameterValidationResult result) Handle results for
| |
| requestPart | back to summary |
|---|---|
| public void requestPart(RequestPart requestPart, ParameterErrors errors) Handle results for
| |