use of org.springframework.web.bind.annotation.InitBinder in project webapp by elimu-ai.
the class AppCreateController method initBinder.
/**
* See http://www.mkyong.com/spring-mvc/spring-mvc-failed-to-convert-property-value-in-file-upload-form/
* <p></p>
* Fixes this error message:
* "Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [byte] for property 'bytes[0]'"
*/
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException {
logger.info("initBinder");
binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
}
use of org.springframework.web.bind.annotation.InitBinder in project portal by ixinportal.
the class ClientWebController method initBinder.
/**
* 自动时间格式转换
* @param binder
* @throws Exception
*/
@InitBinder
public void initBinder(WebDataBinder binder) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
CustomDateEditor dateEditor = new CustomDateEditor(df, true);
binder.registerCustomEditor(Date.class, dateEditor);
}
use of org.springframework.web.bind.annotation.InitBinder in project dq-easy-cloud by dq-open-cloud.
the class EcBaseController method initBinder.
@EcLogAnnotation(logSwitch = false, analysisSwitch = false)
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
DateFormat dateFormat = new SimpleDateFormat(EcDateFormatUtils.FORMAT_NORMAL_DAY);
webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
// webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(DqDateFormatUtils.FORMAT_NORMAL), true));
}
use of org.springframework.web.bind.annotation.InitBinder in project incubator-dubbo-ops by apache.
the class ApiDocsController method initBinder.
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
binder.registerCustomEditor(LocalDate.class, new CustomLocalDateEditor());
binder.registerCustomEditor(LocalDateTime.class, new CustomLocalDateTimeEditor());
}
use of org.springframework.web.bind.annotation.InitBinder in project spring-integration-samples by spring-projects.
the class SharkController method registerConverters.
@InitBinder
void registerConverters(WebDataBinder binder) {
if (binder.getConversionService() instanceof GenericConversionService) {
GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
conversionService.addConverter(getLoanSharkConverter());
}
}
Aggregations