How to download file from inside Seam PDF

Posted by Shervin on Stack Overflow See other posts from Stack Overflow or by Shervin
Published on 2009-10-19T18:12:18Z Indexed on 2010/03/16 10:36 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

Hello. In out project we are creating a pdf by using seam pdf and storing that pdf in the database.

The user can then search up the pdf and view it in their pdf viewer. This is a small portion of the code that is generated to pdf:

<p:html>
<a:repeat var="file" value="#{attachment.files}" rowKeyVar="row">
<s:link action="#{fileHandler.downloadById()}" value="#{file.name}" >
    <f:param  name="fileId" value="#{file.id}"/>
</s:link>
</a:repeat>

When the pdf is rendered, a link is generated that points to:

/project/skjenkebevilling/status/status_pdf.seam?fileId=42&actionMethod=skjenkebevilling%2Fstatus%2Fstatus_pdf.xhtml%3AfileHandler.downloadById()&cid=16

As you can see this link doesnt say much, and the servletpath seems to be missing.

If I change /project with the servletpath

localhost:8080/saksapp/skjenkebevilling/status/status_pdf.seam?fileId=42&actionMethod=skjenkebevilling%2Fstatus%2Fstatus_pdf.xhtml%3AfileHandler.downloadById%28%29&cid=16

Than the download file dialog appears. So my question is, does anyone know how I can input the correct link? And why this s:link doesnt seem to work?

If I cannot do that, then I will need to somehow do search replace and edit the pdf, but that seems like a bit of a hack.

(This is running under JBoss)

Thank you for your time....

© Stack Overflow or respective owner

Related posts about seam

Related posts about pdf