-
1. Re: Specifying a filename for a PDF link on a web page
ericjava.eric.chiralsoftware.net Oct 14, 2008 3:43 AM (in response to ericjava.eric.chiralsoftware.net)Ok, the first problem was a regexp error. That is fixed and there is a rule in place. Now it's trying to fetch:
http://localhost:8080/seam-doc.seam?docId=1&cid=5
and I'm getting:
HTTP Status 404 - /seam-doc.seam
Any ideas on that? I feel like I'm getting closer to it.
-
2. Re: Specifying a filename for a PDF link on a web page
ericjava.eric.chiralsoftware.net Oct 14, 2008 3:45 AM (in response to ericjava.eric.chiralsoftware.net)And more info: this is the exception:
18:42:06,366 WARN [lifecycle] JSF1053: (Listener: org.jboss.seam.pdf.DocumentStorePhaseListener.beforePhase(), Phase ID: RENDER_RESPONSE 6, View ID: /seam-doc.xhtml) Exception thrown during phase-listener execution: java.lang.NullPointerException 18:42:06,370 WARN [lifecycle] org.jboss.seam.pdf.DocumentStorePhaseListener.sendContent(DocumentStorePhaseListener.java:47) org.jboss.seam.pdf.DocumentStorePhaseListener.beforePhase(DocumentStorePhaseListener.java:37) com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
-
3. Re: Specifying a filename for a PDF link on a web page
ericjava.eric.chiralsoftware.net Oct 14, 2008 4:34 AM (in response to ericjava.eric.chiralsoftware.net)I see the fundamental problem. I'm using Seam 2.0.3CR1. In that, looking at DocumentData.java:
public String getFileName() { return getBaseName() + "." + getDocumentType().getExtension(); }
whereas in 2.1CR1:
public String getFileName() { if (fileName == null) { return getBaseName() + "." + getDocumentType().getExtension(); } else { return fileName; } }
So obviously in 2.0, it's always going to return the basename + extension, which is exactly what I don't want to happen.
I should either recompile 2.0 with the improved filename specification or I should switch to 2.1. But this is an important production system so I don't want to switch in such haste. I guess I'm going to try to re-compile 2.0.3CR1. We're going to be generating tons of PDFs and if they all want to save as the same filename it will drive us crazy.
-
4. Re: Specifying a filename for a PDF link on a web page
ericjava.eric.chiralsoftware.net Oct 14, 2008 9:16 PM (in response to ericjava.eric.chiralsoftware.net)I just modified DocumentData.java and UIDocument.java to pass the filename along in the right way and it all works now, in Seam 2.0.3CR1. Seam Team, you might consider putting this fix in for the 2.0.3 GA release, given that it's only a few lines and it's very relevant for almost any real-world use of PDF generation. I would be happy to send over my changes but it's pretty trivial and obvious stuff.