Class WebExchangeBindException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.ErrorResponseException
org.springframework.web.server.ResponseStatusException
org.springframework.web.server.ServerWebInputException
org.springframework.web.bind.support.WebExchangeBindException
- All Implemented Interfaces:
Serializable
,org.springframework.validation.BindingResult
,org.springframework.validation.Errors
,ErrorResponse
public class WebExchangeBindException
extends ServerWebInputException
implements org.springframework.validation.BindingResult
ServerWebInputException
subclass that indicates a data binding or
validation failure.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse
ErrorResponse.Builder
-
Field Summary
Fields inherited from interface org.springframework.validation.BindingResult
MODEL_KEY_PREFIX
Fields inherited from interface org.springframework.validation.Errors
NESTED_PATH_SEPARATOR
-
Constructor Summary
ConstructorDescriptionWebExchangeBindException
(org.springframework.core.MethodParameter parameter, org.springframework.validation.BindingResult bindingResult) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllErrors
(org.springframework.validation.Errors errors) void
addError
(org.springframework.validation.ObjectError error) boolean
findEditor
(String field, Class valueType) List<org.springframework.validation.ObjectError>
final org.springframework.validation.BindingResult
Return the BindingResult that this BindException wraps.Object[]
Return arguments to use along with amessage code
to resolve the problem "detail" for this exception through aMessageSource
.Object[]
getDetailMessageArguments
(org.springframework.context.MessageSource source, Locale locale) Variant ofErrorResponse.getDetailMessageArguments()
that uses the givenMessageSource
for resolving the message argument values.int
org.springframework.validation.FieldError
org.springframework.validation.FieldError
getFieldError
(String field) int
int
getFieldErrorCount
(String field) List<org.springframework.validation.FieldError>
List<org.springframework.validation.FieldError>
getFieldErrors
(String field) Class<?>
getFieldType
(String field) getFieldValue
(String field) org.springframework.validation.ObjectError
int
List<org.springframework.validation.ObjectError>
Returns diagnostic information about the errors held in this object.getModel()
org.springframework.beans.PropertyEditorRegistry
getRawFieldValue
(String field) String[]
boolean
boolean
boolean
hasFieldErrors
(String field) boolean
int
hashCode()
void
void
pushNestedPath
(String subPath) void
recordFieldValue
(String field, Class<?> type, Object value) void
recordSuppressedField
(String field) void
void
void
void
rejectValue
(String field, String errorCode) void
rejectValue
(String field, String errorCode, Object[] errorArgs, String defaultMessage) void
rejectValue
(String field, String errorCode, String defaultMessage) resolveErrorMessages
(org.springframework.context.MessageSource messageSource, Locale locale) Deprecated, for removal: This API element is subject to removal in a future version.String[]
resolveMessageCodes
(String errorCode) String[]
resolveMessageCodes
(String errorCode, String field) void
setNestedPath
(String nestedPath) Methods inherited from class org.springframework.web.server.ServerWebInputException
getMethodParameter
Methods inherited from class org.springframework.web.server.ResponseStatusException
getHeaders, getReason, getResponseHeaders
Methods inherited from class org.springframework.web.ErrorResponseException
getBody, getDetailMessageCode, getStatusCode, setDetail, setInstance, setTitle, setType
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.web.ErrorResponse
getTitleMessageCode, getTypeMessageCode, updateAndGetBody
Methods inherited from interface org.springframework.validation.Errors
failOnError, toString
-
Constructor Details
-
WebExchangeBindException
public WebExchangeBindException(org.springframework.core.MethodParameter parameter, org.springframework.validation.BindingResult bindingResult)
-
-
Method Details
-
getBindingResult
public final org.springframework.validation.BindingResult getBindingResult()Return the BindingResult that this BindException wraps.Will typically be a BeanPropertyBindingResult.
- See Also:
-
BeanPropertyBindingResult
-
getDetailMessageArguments
Description copied from interface:ErrorResponse
Return arguments to use along with amessage code
to resolve the problem "detail" for this exception through aMessageSource
. The arguments are expanded into placeholders of the message value, e.g. "Invalid content type {0}".- Specified by:
getDetailMessageArguments
in interfaceErrorResponse
- Overrides:
getDetailMessageArguments
in classErrorResponseException
-
getDetailMessageArguments
public Object[] getDetailMessageArguments(org.springframework.context.MessageSource source, Locale locale) Description copied from interface:ErrorResponse
Variant ofErrorResponse.getDetailMessageArguments()
that uses the givenMessageSource
for resolving the message argument values.This is useful for example to expand message codes from validation errors.
The default implementation delegates to
ErrorResponse.getDetailMessageArguments()
, ignoring the suppliedMessageSource
andLocale
.- Specified by:
getDetailMessageArguments
in interfaceErrorResponse
- Parameters:
source
- theMessageSource
to use for the lookuplocale
- theLocale
to use for the lookup
-
resolveErrorMessages
@Deprecated(since="6.1", forRemoval=true) public Map<org.springframework.validation.ObjectError,String> resolveErrorMessages(org.springframework.context.MessageSource messageSource, Locale locale) Deprecated, for removal: This API element is subject to removal in a future version.in favor of usingBindErrorUtils
andgetAllErrors()
, to be removed in 6.2Resolve global and field errors to messages with the givenMessageSource
andLocale
.- Returns:
- a Map with errors as key and resolves messages as value
- Since:
- 6.0.3
-
getObjectName
- Specified by:
getObjectName
in interfaceorg.springframework.validation.Errors
-
setNestedPath
- Specified by:
setNestedPath
in interfaceorg.springframework.validation.Errors
-
getNestedPath
- Specified by:
getNestedPath
in interfaceorg.springframework.validation.Errors
-
pushNestedPath
- Specified by:
pushNestedPath
in interfaceorg.springframework.validation.Errors
-
popNestedPath
- Specified by:
popNestedPath
in interfaceorg.springframework.validation.Errors
- Throws:
IllegalStateException
-
reject
- Specified by:
reject
in interfaceorg.springframework.validation.Errors
-
reject
- Specified by:
reject
in interfaceorg.springframework.validation.Errors
-
reject
- Specified by:
reject
in interfaceorg.springframework.validation.Errors
-
rejectValue
- Specified by:
rejectValue
in interfaceorg.springframework.validation.Errors
-
rejectValue
- Specified by:
rejectValue
in interfaceorg.springframework.validation.Errors
-
rejectValue
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs, @Nullable String defaultMessage) - Specified by:
rejectValue
in interfaceorg.springframework.validation.Errors
-
addAllErrors
public void addAllErrors(org.springframework.validation.Errors errors) - Specified by:
addAllErrors
in interfaceorg.springframework.validation.Errors
-
hasErrors
public boolean hasErrors()- Specified by:
hasErrors
in interfaceorg.springframework.validation.Errors
-
getErrorCount
public int getErrorCount()- Specified by:
getErrorCount
in interfaceorg.springframework.validation.Errors
-
getAllErrors
- Specified by:
getAllErrors
in interfaceorg.springframework.validation.Errors
-
hasGlobalErrors
public boolean hasGlobalErrors()- Specified by:
hasGlobalErrors
in interfaceorg.springframework.validation.Errors
-
getGlobalErrorCount
public int getGlobalErrorCount()- Specified by:
getGlobalErrorCount
in interfaceorg.springframework.validation.Errors
-
getGlobalErrors
- Specified by:
getGlobalErrors
in interfaceorg.springframework.validation.Errors
-
getGlobalError
@Nullable public org.springframework.validation.ObjectError getGlobalError()- Specified by:
getGlobalError
in interfaceorg.springframework.validation.Errors
-
hasFieldErrors
public boolean hasFieldErrors()- Specified by:
hasFieldErrors
in interfaceorg.springframework.validation.Errors
-
getFieldErrorCount
public int getFieldErrorCount()- Specified by:
getFieldErrorCount
in interfaceorg.springframework.validation.Errors
-
getFieldErrors
- Specified by:
getFieldErrors
in interfaceorg.springframework.validation.Errors
-
getFieldError
@Nullable public org.springframework.validation.FieldError getFieldError()- Specified by:
getFieldError
in interfaceorg.springframework.validation.Errors
-
hasFieldErrors
- Specified by:
hasFieldErrors
in interfaceorg.springframework.validation.Errors
-
getFieldErrorCount
- Specified by:
getFieldErrorCount
in interfaceorg.springframework.validation.Errors
-
getFieldErrors
- Specified by:
getFieldErrors
in interfaceorg.springframework.validation.Errors
-
getFieldError
- Specified by:
getFieldError
in interfaceorg.springframework.validation.Errors
-
getFieldValue
- Specified by:
getFieldValue
in interfaceorg.springframework.validation.Errors
-
getFieldType
- Specified by:
getFieldType
in interfaceorg.springframework.validation.Errors
-
getTarget
- Specified by:
getTarget
in interfaceorg.springframework.validation.BindingResult
-
getModel
- Specified by:
getModel
in interfaceorg.springframework.validation.BindingResult
-
getRawFieldValue
- Specified by:
getRawFieldValue
in interfaceorg.springframework.validation.BindingResult
-
findEditor
- Specified by:
findEditor
in interfaceorg.springframework.validation.BindingResult
-
getPropertyEditorRegistry
@Nullable public org.springframework.beans.PropertyEditorRegistry getPropertyEditorRegistry()- Specified by:
getPropertyEditorRegistry
in interfaceorg.springframework.validation.BindingResult
-
resolveMessageCodes
- Specified by:
resolveMessageCodes
in interfaceorg.springframework.validation.BindingResult
-
resolveMessageCodes
- Specified by:
resolveMessageCodes
in interfaceorg.springframework.validation.BindingResult
-
addError
public void addError(org.springframework.validation.ObjectError error) - Specified by:
addError
in interfaceorg.springframework.validation.BindingResult
-
recordFieldValue
- Specified by:
recordFieldValue
in interfaceorg.springframework.validation.BindingResult
-
recordSuppressedField
- Specified by:
recordSuppressedField
in interfaceorg.springframework.validation.BindingResult
-
getSuppressedFields
- Specified by:
getSuppressedFields
in interfaceorg.springframework.validation.BindingResult
-
getMessage
Returns diagnostic information about the errors held in this object.- Overrides:
getMessage
in classResponseStatusException
-
equals
-
hashCode
public int hashCode()
-
BindErrorUtils
andgetAllErrors()
, to be removed in 6.2