Java Code Examples for org.springframework.web.multipart.support.StringMultipartFileEditor
The following examples show how to use
org.springframework.web.multipart.support.StringMultipartFileEditor. 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: spring-analysis-note Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFileAsString() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("name", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals("Juergen", target.getName()); }
Example 2
Source Project: spring-analysis-note Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFileAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(1, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); }
Example 3
Source Project: spring-analysis-note Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFilesAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); request.addFile(new MockMultipartFile("stringArray", "Eva".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(2, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); assertEquals("Eva", target.getStringArray()[1]); }
Example 4
Source Project: java-technology-stack Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFileAsString() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("name", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals("Juergen", target.getName()); }
Example 5
Source Project: java-technology-stack Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFileAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(1, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); }
Example 6
Source Project: java-technology-stack Source File: WebRequestDataBinderTests.java License: MIT License | 5 votes |
@Test public void testMultipartFilesAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); request.addFile(new MockMultipartFile("stringArray", "Eva".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(2, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); assertEquals("Eva", target.getStringArray()[1]); }
Example 7
Source Project: spring4-understanding Source File: WebRequestDataBinderTests.java License: Apache License 2.0 | 5 votes |
@Test public void testMultipartFileAsString() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("name", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals("Juergen", target.getName()); }
Example 8
Source Project: spring4-understanding Source File: WebRequestDataBinderTests.java License: Apache License 2.0 | 5 votes |
@Test public void testMultipartFileAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(1, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); }
Example 9
Source Project: spring4-understanding Source File: WebRequestDataBinderTests.java License: Apache License 2.0 | 5 votes |
@Test public void testMultipartFilesAsStringArray() { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); request.addFile(new MockMultipartFile("stringArray", "Juergen".getBytes())); request.addFile(new MockMultipartFile("stringArray", "Eva".getBytes())); binder.bind(new ServletWebRequest(request)); assertEquals(2, target.getStringArray().length); assertEquals("Juergen", target.getStringArray()[0]); assertEquals("Eva", target.getStringArray()[1]); }
Example 10
Source Project: AlgoTrader Source 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 11
Source Project: spring-analysis-note Source File: ServletAnnotationControllerHandlerMethodTests.java License: MIT License | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); }
Example 12
Source Project: java-technology-stack Source File: ServletAnnotationControllerHandlerMethodTests.java License: MIT License | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); }
Example 13
Source Project: spring4-understanding Source File: ServletAnnotationControllerTests.java License: Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); }
Example 14
Source Project: spring4-understanding Source File: ServletAnnotationControllerHandlerMethodTests.java License: Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); }