[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1350) Provide download component (e.g.<s:download value=#{FileManager.getFileById('10')" contentType="#{FileManager.contentType}" />)

Pete Muir (JIRA) jira-events at lists.jboss.org
Sun Jun 10 19:56:11 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1350?page=comments#action_12364819 ] 
            
Pete Muir commented on JBSEAM-1350:
-----------------------------------

My current idea on this is that you can do

<s:download src="/foo/bar.xhtml">
   <f:param name="username" value="pmuir" />
</s:download>

The generated url would be

http://localhost:8080/booking/foo/bar.seam?username=pmuir

where /foo/bar.xhtml is something like

<s:resource xmlns=.... value="#{backingBean.data}" contentType="#{backingBean.contentType}" />

and /foo/bar.page.xml is

<page>
   <param name="username" value="#{backingBean.username}" />
</page>

The trick is then hack the faces lifecycle so that it doesn't write anything to the browser, but instead we write out our resource.


N.B. This extra layer of abstraction is necessary as to serve resources restfully.

We should also support

<s:download>
   <s:resource value="#{backingBean.data}" contentType="#{backingBean.contentType}" />
</s:download>

if the user doesn't care about serving restfully.

> Provide download component (e.g.<s:download value=#{FileManager.getFileById('10')" contentType="#{FileManager.contentType}" />)
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-1350
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1350
>             Project: JBoss Seam
>          Issue Type: Feature Request
>            Reporter: jarkko Lietolahti
>         Assigned To: Pete Muir
>
> <s:download value=#{FileManager.getFileById('10')" contentType="#{FileManager.contentType}" />
> We're going to create new (more general component) which allows the user to download a  file (any resource, Excel file, Document whatever). 
> The plan is to create a new UI component named UIDownload which has attributes like value, contentType (some more?).
> 1) UIDownload a backing bean (value) (is this still valid word in the seam world?) to generate the data ( allow byte[], OutputStreams ?). 
> 2) UIDownload creates DownloadResource which is stored in DownloadStore.
> 3) UIDownload generates HTML which redirects the browser to ResourceServlet 
> 4) ResourceServlet then uses DownloadResource to get hold of the data and the pushes it to browser
> The reason for this is that we're building portlets with Seam and it's impossible to "download" files from a portal environment without additional servlet and we think it's good idea to reuse existing stuff. 
> Patch coming soon (if we can make it work ;)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list