Java Code Examples for org.springframework.web.multipart.support.ByteArrayMultipartFileEditor
The following examples show how to use
org.springframework.web.multipart.support.ByteArrayMultipartFileEditor.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: ankush Author: Impetus File: BaseController.java License: GNU Lesser General Public License v3.0 | 6 votes |
/** * Set up a custom property editor for converting form inputs to real * objects. * * @param request the current request * @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( "yyyy.MM.dd G 'at' HH:mm:ss z"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, null, new CustomDateEditor( dateFormat, true)); }
Example #2
Source Project: AlgoTrader Author: curtiszimmerman File: GrailsDataBinder.java License: GNU General Public License v2.0 | 5 votes |
/** * Utility method for creating a GrailsDataBinder instance * * @param target The target object to bind to * @param objectName The name of the object * @return A GrailsDataBinder instance */ public static GrailsDataBinder createBinder(Object target, String objectName) { GrailsDataBinder binder = new GrailsDataBinder(target, objectName); binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); binder.registerCustomEditor(Currency.class, new CurrencyEditor()); binder.registerCustomEditor(Locale.class, new LocaleEditor()); binder.registerCustomEditor(TimeZone.class, new TimeZoneEditor()); binder.registerCustomEditor(URI.class, new UriEditor()); registerCustomEditors(binder); return binder; }
Example #3
Source Project: webcurator Author: DIA-NZ File: TargetSeedsHandler.java License: Apache License 2.0 | 5 votes |
@Override public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { // Determine the necessary formats. NumberFormat nf = NumberFormat.getInstance(request.getLocale()); // Register the binders. binder.registerCustomEditor(Long.class, new CustomNumberEditor(Long.class, nf, true)); // to actually be able to convert Multipart instance to byte[] // we have to register a custom editor (in this case the // ByteArrayMultipartEditor binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); // now Spring knows how to handle multipart object and convert them }
Example #4
Source Project: webcurator Author: DIA-NZ File: TreeToolController.java License: Apache License 2.0 | 5 votes |
@Override public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { // Determine the necessary formats. NumberFormat nf = NumberFormat.getInstance(request.getLocale()); // Register the binders. binder.registerCustomEditor(Long.class, new CustomNumberEditor(Long.class, nf, true)); binder.registerCustomEditor(Boolean.class, "propagateDelete", new CustomBooleanEditor(true)); // to actually be able to convert Multipart instance to byte[] // we have to register a custom editor (in this case the // ByteArrayMultipartEditor binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); // now Spring knows how to handle multipart object and convert them }
Example #5
Source Project: cacheonix-core Author: cacheonix File: PetDescriptionUploadController.java License: GNU Lesser General Public License v2.1 | 4 votes |
/** * Register the PropertyEditor for converting from a MultipartFile to an array of bytes. */ @InitBinder public void registerMultipartEditor(WebDataBinder binder) { binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); }