Search in sources :

Example 16 with InitBinder

use of org.springframework.web.bind.annotation.InitBinder in project uPortal by Jasig.

the class BaseStatisticsReportController method initBinder.

@InitBinder
public void initBinder(WebDataBinder binder) {
    final DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendPattern("M/d/yyyy").toFormatter();
    binder.registerCustomEditor(DateMidnight.class, new CustomDateMidnightEditor(formatter, false));
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTimeFormatterBuilder(org.joda.time.format.DateTimeFormatterBuilder) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Example 17 with InitBinder

use of org.springframework.web.bind.annotation.InitBinder in project SpringStepByStep by JavaProgrammerLB.

the class TodoController method initBinder.

@InitBinder
public void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(TodoListUtils.DATE_FORMAT);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    binder.registerCustomEditor(Priority.class, new TodoPriorityPropertyEditor());
}
Also used : CustomDateEditor(org.springframework.beans.propertyeditors.CustomDateEditor) SimpleDateFormat(java.text.SimpleDateFormat) TodoPriorityPropertyEditor(com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Example 18 with InitBinder

use of org.springframework.web.bind.annotation.InitBinder in project Asqatasun by Asqatasun.

the class AbstractUserAndContractsController method initBinder.

@InitBinder
protected void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
Also used : CustomDateEditor(org.springframework.beans.propertyeditors.CustomDateEditor) SimpleDateFormat(java.text.SimpleDateFormat) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Example 19 with InitBinder

use of org.springframework.web.bind.annotation.InitBinder in project webapp by elimu-ai.

the class ApplicationVersionCreateController 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());
}
Also used : ByteArrayMultipartFileEditor(org.springframework.web.multipart.support.ByteArrayMultipartFileEditor) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Example 20 with InitBinder

use of org.springframework.web.bind.annotation.InitBinder in project webapp by elimu-ai.

the class AudioCreateController 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());
}
Also used : ByteArrayMultipartFileEditor(org.springframework.web.multipart.support.ByteArrayMultipartFileEditor) InitBinder(org.springframework.web.bind.annotation.InitBinder)

Aggregations

InitBinder (org.springframework.web.bind.annotation.InitBinder)35 SimpleDateFormat (java.text.SimpleDateFormat)13 CustomDateEditor (org.springframework.beans.propertyeditors.CustomDateEditor)13 ByteArrayMultipartFileEditor (org.springframework.web.multipart.support.ByteArrayMultipartFileEditor)9 DateFormat (java.text.DateFormat)6 StringTrimmerEditor (org.springframework.beans.propertyeditors.StringTrimmerEditor)3 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)3 PropertyEditorSupport (java.beans.PropertyEditorSupport)2 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)2 DateTimeFormatterBuilder (org.joda.time.format.DateTimeFormatterBuilder)2 DateConvertEditor (com.cdeledu.core.interceptors.DateConvertEditor)1 TodoPriorityPropertyEditor (com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor)1 DateTimePropertyEditorSupport (hry.core.util.springmvcPropertyeditor.DateTimePropertyEditorSupport)1 StringPropertyEditorSupport (hry.core.util.springmvcPropertyeditor.StringPropertyEditorSupport)1 NumberFormat (java.text.NumberFormat)1 NonNullBooleanEditor (org.broadleafcommerce.openadmin.web.editor.NonNullBooleanEditor)1 CustomNumberEditor (org.springframework.beans.propertyeditors.CustomNumberEditor)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 DefinitionTypeConverter (org.talend.components.service.rest.DefinitionTypeConverter)1 ConnectorTypologyConverter (org.talend.components.service.rest.dto.ConnectorTypologyConverter)1