spring-framework / org.springframework.web.bind.support

Package org.springframework.web.bind.support

Types

ConfigurableWebBindingInitializer

open class ConfigurableWebBindingInitializer : WebBindingInitializer

Convenient WebBindingInitializer for declarative configuration in a Spring application context. Allows for reusing pre-configured initializers with multiple controller/handlers.

DefaultDataBinderFactory

open class DefaultDataBinderFactory : WebDataBinderFactory

Create a WebRequestDataBinder instance and initialize it with a WebBindingInitializer.

DefaultSessionAttributeStore

open class DefaultSessionAttributeStore : SessionAttributeStore

Default implementation of the SessionAttributeStore interface, storing the attributes in the WebRequest session (i.e. HttpSession or PortletSession).

SimpleSessionStatus

open class SimpleSessionStatus : SessionStatus

Simple implementation of the SessionStatus interface, keeping the complete flag as an instance variable.

SpringWebConstraintValidatorFactory

open class SpringWebConstraintValidatorFactory : ConstraintValidatorFactory

JSR-303 ConstraintValidatorFactory implementation that delegates to the current Spring WebApplicationContext for creating autowired ConstraintValidator instances.

In contrast to org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory, this variant is meant for declarative use in a standard validation.xml file, e.g. in combination with JAX-RS or JAX-WS.

WebArgumentResolver

interface WebArgumentResolver

SPI for resolving custom arguments for a specific handler method parameter. Typically implemented to detect special parameter types, resolving well-known argument values for them.

A typical implementation could look like as follows:

 public class MySpecialArgumentResolver implements WebArgumentResolver { public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) { if (methodParameter.getParameterType().equals(MySpecialArg.class)) { return new MySpecialArg("myValue"); } return UNRESOLVED; } }

WebDataBinderFactory

interface WebDataBinderFactory

A factory for creating a WebDataBinder instance for a named target object.

WebExchangeDataBinder

open class WebExchangeDataBinder : WebDataBinder

Specialized org.springframework.validation.DataBinder to perform data binding from URL query params or form data in the request data to Java objects.

WebRequestDataBinder

open class WebRequestDataBinder : WebDataBinder

Special org.springframework.validation.DataBinder to perform data binding from web request parameters to JavaBeans, including support for multipart files.

See the DataBinder/WebDataBinder superclasses for customization options, which include specifying allowed/required fields, and registering custom property editors.

Can also used for manual data binding in custom web controllers or interceptors that build on Spring's org.springframework.web.context.request.WebRequest abstraction: e.g. in a org.springframework.web.context.request.WebRequestInterceptor implementation. Simply instantiate a WebRequestDataBinder for each binding process, and invoke bind with the current WebRequest as argument:

 MyBean myBean = new MyBean(); // apply binder to custom target object WebRequestDataBinder binder = new WebRequestDataBinder(myBean); // register custom editors, if desired binder.registerCustomEditor(...); // trigger actual binding of request parameters binder.bind(request); // optionally evaluate binding errors Errors errors = binder.getErrors(); ...

Exceptions

WebExchangeBindException

open class WebExchangeBindException : ServerWebInputException, BindingResult

A specialization of ServerWebInputException thrown when after data binding and validation failure. Implements BindingResult (and its super-interface Errors) to allow for direct analysis of binding and validation errors.