List of usage examples for org.springframework.web.multipart.support ByteArrayMultipartFileEditor ByteArrayMultipartFileEditor
ByteArrayMultipartFileEditor
From source file:org.jrecruiter.web.controller.BaseFormController.java
/** * Set up a custom property editor for converting form inputs to real objects * @param request the current request//from w w w . j a v a 2 s . c om * @param binder the data binder */ @InitBinder protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) { binder.registerCustomEditor(Integer.class, null, new CustomNumberEditor(Integer.class, null, true)); binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, null, true)); binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); SimpleDateFormat dateFormat = new SimpleDateFormat(getText("date.format", request.getLocale())); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true)); }
From source file:org.pentaho.pat.server.servlet.FileUploadController.java
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); super.initBinder(request, binder); }
From source file:no.dusken.aranea.admin.control.EditLoginDetailsController.java
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { super.initBinder(request, binder); binder.registerCustomEditor(List.class, "roles", rolesEditor); // to actually be able to convert Multipart instance to byte[] // we have to register a custom editor binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); binder.setBindEmptyMultipartFiles(false); }
From source file:org.literacyapp.web.content.multimedia.audio.AudioCreateController.java
/** * See http://www.mkyong.com/spring-mvc/spring-mvc-failed-to-convert-property-value-in-file-upload-form/ * <p></p>/*from w ww . j a v a2s . c o m*/ * 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()); }
From source file:edu.duke.cabig.c3pr.web.study.StudyController.java
@Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.setAutoGrowNestedPaths(Boolean.FALSE); super.initBinder(request, binder); binder.registerCustomEditor(Date.class, ControllerTools.getDateEditor(false)); binder.registerCustomEditor(healthcareSiteDao.domainClass(), new CustomDaoEditor(healthcareSiteDao)); binder.registerCustomEditor(healthcareSiteInvestigatorDao.domainClass(), new NullIdDaoBasedEditor(healthcareSiteInvestigatorDao)); binder.registerCustomEditor(personUserDao.domainClass(), new NullIdDaoBasedEditor(personUserDao)); binder.registerCustomEditor(studyDao.domainClass(), new CustomDaoEditor(studyDao)); binder.registerCustomEditor(Integer.class, new CustomNumberEditor(Integer.class, true)); binder.registerCustomEditor(String.class, "file", new StringMultipartFileEditor()); binder.registerCustomEditor(byte[].class, "study.criteriaFile", new ByteArrayMultipartFileEditor()); binder.registerCustomEditor(StudyPart.class, new EnumByNameEditor(StudyPart.class)); binder.registerCustomEditor(ConsentRequired.class, new EnumByNameEditor(ConsentRequired.class)); binder.registerCustomEditor(OrganizationIdentifierTypeEnum.class, new EnumByNameEditor(OrganizationIdentifierTypeEnum.class)); binder.registerCustomEditor(RandomizationType.class, new EnumByNameEditor(RandomizationType.class)); binder.registerCustomEditor(CoordinatingCenterStudyStatus.class, new EnumByNameEditor(CoordinatingCenterStudyStatus.class)); binder.registerCustomEditor(InvestigatorStatusCodeEnum.class, new EnumByNameEditor(InvestigatorStatusCodeEnum.class)); binder.registerCustomEditor(SiteStudyStatus.class, new EnumByNameEditor(SiteStudyStatus.class)); binder.registerCustomEditor(EpochType.class, new EnumByNameEditor(EpochType.class)); binder.registerCustomEditor(ConsentingMethod.class, new EnumByNameEditor(ConsentingMethod.class)); binder.registerCustomEditor(StudySponsorType.class, new EnumByNameEditor(StudySponsorType.class)); binder.registerCustomEditor(StudyCategory.class, new EnumByNameEditor(StudyCategory.class)); binder.registerCustomEditor(NCIRecognizedProgramName.class, new EnumByNameEditor(NCIRecognizedProgramName.class)); }
From source file:se.gothiaforum.controller.actorsform.AddImageController.java
protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); }
From source file:no.dusken.aranea.admin.control.EditPageController.java
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { super.initBinder(request, binder); binder.registerCustomEditor(Section.class, sectionEditor); binder.registerCustomEditor(List.class, "tags", tagsEditor); binder.registerCustomEditor(Calendar.class, timeEditor); binder.registerCustomEditor(List.class, "authors", authorsEditor); // to actually be able to convert Multipart instance to byte[] // we have to register a custom editor binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); binder.setBindEmptyMultipartFiles(false); // now Spring knows how to handle multipart object and convert them /*dont allow properties like published to be binded, so that it is not possible to set published to true * by tampering with the formsubmission * */// w w w . j a v a 2s. c o m String[] disallowedFields = new String[] { "published, modified, timePublished, " + "topic, sectionPriority, frontsidePriority" }; binder.setDisallowedFields(disallowedFields); }
From source file:alpha.portal.webapp.controller.BaseFormController.java
/** * Set up a custom property editor for converting form inputs to real * objects.// w ww .j av a 2 s.com * * @param request * the current request * @param binder * the data binder */ @InitBinder protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) { binder.registerCustomEditor(Integer.class, null, new CustomNumberEditor(Integer.class, null, true)); binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, null, true)); binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); final SimpleDateFormat dateFormat = new SimpleDateFormat(this.getText("date.format", request.getLocale())); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true)); }
From source file:com.lm.lic.manager.controller.AddProductController.java
@Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws ServletException { // to actually be able to convert Multipart instance to byte[] // we have to register a custom editor binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); // now Spring knows how to handle multipart object and convert them }
From source file:com.jaspersoft.jasperserver.war.action.EditMondrianXmlaSourceAction.java
/** * initBinder initializes binder object//from ww w .j a v a2 s . c o m * * @param context * @param binder */ public void initBinder(RequestContext context, DataBinder binder) { binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); }