List of usage examples for org.springframework.web.bind ServletRequestDataBinder setAllowedFields
public void setAllowedFields(@Nullable String... allowedFields)
From source file:common.bind.CommonBindValidator.java
/** * an empty method//from ww w .j a v a 2s . c o m * @param binder */ @Override protected void initBinder(ServletRequestDataBinder binder) { binder.setBindEmptyMultipartFiles(false); binder.setRequiredFields(required_fields); binder.setAllowedFields(allowed_fields); binder.setFieldMarkerPrefix("_"); binder.setFieldDefaultPrefix("!"); if (editors != null) { Iterator<Entry<String, PropertyEditor>> i = editors.entrySet().iterator(); while (i.hasNext()) { Entry<String, PropertyEditor> e = i.next(); binder.registerCustomEditor(String.class, e.getKey(), e.getValue()); } } binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); }
From source file:org.bibsonomy.webapp.util.spring.controller.MinimalisticControllerSpringWrapper.java
@Override protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) throws Exception { super.initBinder(request, binder); /*/*from w w w . jav a 2 s. c o m*/ * set convertion service (string => enum, string => class) */ binder.setConversionService(this.conversionService); /* * Register a custom date editor to support binding of date fields. * * FIXME: This is a HACK to allow the DBLP update to set the date of * (bookmark) posts. The problem is, that the date format is now fixed * for ALL our controllers, since we can't override this initBinder * method (since we're using this MinimalisticController ... wrapper) * */ binder.registerCustomEditor(Date.class, new CustomDateEditor(DATE_FORMAT, true)); /* * setting the dis/allowed fields for the binder */ binder.setAllowedFields(allowedFields); binder.setDisallowedFields(disallowedFields); }