[ http://mc4j.org/jira/browse/STS-304?page=comments#action_10517 ] 
            
Andy commented on STS-304:
--------------------------

No, you cannot use new FileInputStream(fileBean.getFileName()) because 
getFileName() returns the client-side filename, sometimes with path. With 
CommonsMultipartWrapper, the uploaded stream (if small enough) is not saved as 
a server-side file.

I'm not saying that there aren't use cases for bean.getReader(); I'm just 
suggesting that Util.getReader(bean) (where Util is not a Stripes class) looks 
like a more appropriate place for this functionality, since the application 
knows best what kind of Reader and charset it expects.

Writing Util.getReader(bean) is trivial. Writing a decent servlet without 
Stripes isn't trivial. (And FileReader won't work properly on binary files. In 
fact that's why getInputStream() is not just nice to have, it's necessary.)

Strictly speaking, getInputStream() and getReader() can potentially return 
different things, and if somebody writes a new MultipartWrapper, they'll have 
to know which one to override, and so on. Somebody will want to write a new 
MultipartWrapper which returns a subclass of FileBean with a customized 
getReader method (that always uses UTF-8, for example).

I find the gain from adding getReader() into FileBean isn't worth the loss of 
simplicity found by having only one getter to get at the same one thing.

But of course, a simple implementation of bean.getReader() is trivial to add 
and its presence doesn't affect those who don't use it. But those who rely on 
it should be prepared that a future version of Stripes may redefine 
bean.getReader() in a different way. For example, should the method contract 
define that bean.getReader()==bean.getReader() will always be true or always be 
false?

> 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

Reply via email to