jboss - How to download file from inside Seam PDF -


In the Out Project, we are creating PDF by using the seam PDF and storing that PDF in the database.

The user can then search the PDF and view it in his PDF viewer. It is a small part of the code that is generated by PDF:

  & lt; P: html & gt; & Lt; A: Repeat var = "file" value = "# {attachment.files}" line = "row" & gt; & Lt; S: link action = "# {fileHandler.downloadById ()}" value = "# {file.name}" & gt; & Lt; F: Ultimate name = "file id" value = "# {file.id}" /> & Lt; / S: Link & gt; & Lt; / A: Repeat & gt;  

When a PDF is provided, a link that indicates is generated:

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

As you can see this link does not say much, and servletpath seems missing.

If I / I change the project with servletapath

 localhost: 8080 / saksapp / skjenkebevilling / status / status_pdf.seam? FileId = 42 and Action Method = ScanViewing% 2 Status% 2Fstatus_pdf.xhtml% 3AfileHandler.downloadById% 28% 29 and cid = 16 

The file file appears more than the dialog. So my question is, does anyone know how can I input the correct link? And why is this: Links seem to work?

If I can not do this, then I will need to change and edit PDF in any way, but it seems that a hack seems a bit identical.

(It's running under Jbis)

Thank you for your time ....

I found an alternative solution for this problem I have to use the S: Link with a normal one href tag HR tag does not work for any reason only .

  & lt; S: link action = "# {fileHandler.downloadById ()}" value = "# {file.name}" publicity = "none" & gt; & Lt; F: Ultimate name = "file id" value = "# {file.id}" /> & Lt; / S: Link & gt; & Lt; A href = "# {servletPath.path}? FileId = # {file.id} & amp; verb method = # {path.replace ('/', '')}% 2 fattus% 2 fattus_pdf xmll% 3philehandler DownloadById () & amp; amp; "& gt; Download & lt; / A & gt;  

ServletPath.path returns the servlet path that means that if you want users to log in before downloading a file, you can decide to enter login-required = true on the download.

  @obwewer ("org.jboss.seam.security.login is successful") Public Null Servlet Path () {HttpServletRequest Request = (HttpServletRequest) FacesContext.getCurrentInstance (). GetExternalContext (). GetRequest (); This.path = request.getRequestURL (). ToString () Replace ("login.seam", "download.seam"); }  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -