In this thread:
http://groups.google.com/group/play-framework/browse_thread/thread/cbf2af5b20a43893
someone asked if they could render a PDF file while inside a job. It
was determined that this was not possible at the time because when
you're in a job there is no current request object. There was a fix
for sending mails in a job in 1.2 that created a fake request object,
but the implementation of that was changed in 1.2.2 so we no longer
have a fake request object. So we still get NPE:
Caused by: java.lang.NullPointerException
at play.modules.pdf.PDF.writePDF(PDF.java:159)
at play.modules.pdf.PDF.writePDF(PDF.java:144)
at controllers.Reports$1.doJobWithResult(Reports.java:316)
at controllers.Reports$1.doJobWithResult(Reports.java:1)
at play.jobs.Job.call(Job.java:146)
... 8 more
Looking at the PDF module source code, it looks like it only really
needs the request for three things:
1. to find the current template name when none is supplied (PDF line
159),
2. to resolve the template name if it hasn't been supplied with full
dotted notation (PDF line 197/RenderPDFTemplate line 60), and
3. to pass the base URI into YaHP (RenderPDFTemplate line 116)
All of these problems could be worked around by moving around code to
allow for a null request except in precisely the point where it is
necessary. Is this a solution that might be looked at for the module,
or is there another workaround that I don't know about?
Alison