Class ExtendedServletRequestDataBinder

All Implemented Interfaces:
PropertyEditorRegistry, TypeConverter

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

WARNING: Data binding can lead to security issues by exposing parts of the object graph that are not meant to be accessed or modified by external clients. Therefore, the design and use of data binding should be considered carefully with regard to security. For more details, please refer to the dedicated sections on data binding for Spring Web MVC and Spring WebFlux in the reference manual.

Since:
3.1
Author:
Rossen Stoyanchev
See Also:
  • Constructor Details

    • ExtendedServletRequestDataBinder

      public ExtendedServletRequestDataBinder(@Nullable Object target)
      Create a new instance, with default object name.
      Parameters:
      target - the target object to bind onto (or null if the binder is just used to convert a plain parameter value)
      See Also:
    • ExtendedServletRequestDataBinder

      public ExtendedServletRequestDataBinder(@Nullable Object target, String objectName)
      Create a new instance.
      Parameters:
      target - the target object to bind onto (or null if the binder is just used to convert a plain parameter value)
      objectName - the name of the target object
      See Also:
  • Method Details

    • addHeaderPredicate

      public void addHeaderPredicate(Predicate<String> headerPredicate)
      Add a Predicate that filters the header names to use for data binding. Multiple predicates are combined with AND.
      Parameters:
      headerPredicate - the predicate to add
      Since:
      6.2.1
    • setHeaderPredicate

      public void setHeaderPredicate(Predicate<String> headerPredicate)
      Set the Predicate that filters the header names to use for data binding.

      Note that this method resets any previous predicates that may have been set, including headers excluded by default such as the RFC 9218 defined "Priority" header.

      Parameters:
      headerPredicate - the predicate to add
      Since:
      6.2.1
    • createValueResolver

      Description copied from class: ServletRequestDataBinder
      Allow subclasses to create the DataBinder.ValueResolver instance to use.
      Overrides:
      createValueResolver in class ServletRequestDataBinder
    • addBindValues

      protected void addBindValues(MutablePropertyValues mpvs, ServletRequest request)
      Merge URI variables into the property values to use for data binding.
      Overrides:
      addBindValues in class ServletRequestDataBinder
      Parameters:
      mpvs - the property values that will be used for data binding
      request - the current request