spring-framework / org.springframework.web.servlet.mvc.method.annotation / ExtendedServletRequestDataBinder

ExtendedServletRequestDataBinder

open class ExtendedServletRequestDataBinder : ServletRequestDataBinder

Subclass of ServletRequestDataBinder that adds URI template variables to the values used for data binding.

Author
Rossen Stoyanchev

Since
3.1

Constructors

<init>

ExtendedServletRequestDataBinder(target: Any)

Create a new instance, with default object name.

ExtendedServletRequestDataBinder(target: Any, objectName: String)

Create a new instance.

Inherited Functions

bind

open fun bind(request: ServletRequest): Unit

Bind the parameters of the given request to this binder's target, also binding multipart files in case of a multipart request.

This call can create field errors, representing basic binding errors like a required field (code "required"), or type mismatch between value and bean property (code "typeMismatch").

Multipart files are bound via their parameter name, just like normal HTTP parameters: i.e. "uploadedFile" to an "uploadedFile" bean property, invoking a "setUploadedFile" setter method.

The type of the target property for a multipart file can be MultipartFile, byte[], or String. The latter two receive the contents of the uploaded file; all metadata like original file name, content type, etc are lost in those cases.

closeNoCatch

open fun closeNoCatch(): Unit

Treats errors as fatal.

Use this method only if it's an error if the input isn't valid. This might be appropriate if all input is from dropdowns, for example.