[ http://mc4j.org/jira/browse/STS-304?page=comments#action_10518 ] Ben Gunter commented on STS-304: --------------------------------
OK, you got me on the getInputStream()/getFileName() thing. Obviously, I'm just getting acquainted with it. (I used COS some years ago for file uploads, but I forgot those details.) But as someone who was using FileBean for the first time, I found myself looking for a getReader() method that wasn't there, and in the interest of symmetry it seemed obvious to me that there should be a getReader() method to match getInputStream(). Now that I've looked at the various overloaded constructors for InputStreamReader, I can see where you're coming from. But this might be simpler than all that. When a file is posted -- assuming it is a text file -- the charset with which it is encoded is sent along in the request headers. Normally, that's the only charset with which the file should be decoded, so providing a getReader() that reads the file using the charset specified in the request headers does actually save some work for programmers. I.e. file.getReader() is easier than new InputStreamReader(file.getInputStream(), getContext().getRequest().getCharacterEncoding()). And, in fact, since ServletRequest.getCharaceterEncoding() can return null, if you throw in a null check it gets even more complex. Correct me if I'm wrong about any of the above. I'm now even more convinced that a getReader() that uses the request charset will be a good thing. > add FileBean.getReader() > ------------------------ > > Key: STS-304 > URL: http://mc4j.org/jira/browse/STS-304 > Project: Stripes > Issue Type: Improvement > Affects Versions: Release 1.4.1 > Reporter: Ben Gunter > Assigned To: Tim Fennell > Priority: Trivial > > FileBean should provide a method > public java.io.Reader getReader() > to complement the getInputStream() method. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://mc4j.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Stripes-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-development
