Adam Winer (JIRA) wrote:
Add actionListener to make sending files easy
---------------------------------------------

                 Key: TRINIDAD-52
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-52
             Project: MyFaces Trinidad
          Issue Type: New Feature
    Affects Versions: 1.0.0-incubating-core
            Reporter: Adam Winer


Currently, it takes some error-prone and manual code to send a file when 
clicking on a link.  This could be bundled up into a listener, something like:

  <tr:commandLink text="Download file">
    <tr:sendFileActionListener
       mimeType="application/pdf" fileName="#{myBean.fileName}"
       sendFileListener="#{myBean.sendFile}"/>
  </tr:commandLink>

... where all the user needs to write is:

public void sendFile(OutputStream os) throws IOException
{
  // write bytes
}

... and we'd set the right headers, call FacesContext.responseComplete(), etc.

Wow, that's great feature.

--
Luka Ĺ urija
[EMAIL PROTECTED]
+385 98 434 061

I.Y. tim d.o.o.
www.iytim.hr
[EMAIL PROTECTED]


Reply via email to