Re: [XSL-FO] Re: Blank page on pdf download and general question
- Ivan wrote:
> Why save the file to disk?Because the process is:This is not thread safe. The file might be written by several
> -checks if the file is present
> -if so, let's serve the file
> -if it doesn't, let's transform the file and serve it.
> This is due as the transformation process takes a little bit longer.
threads. Also, an incompletely rendered file might be read.
You'll have to check on a synchronized hash map or something
whether rendering for a certain URL is in progress, and somehow
wait for it to finish before accessing the file. This is tricky.
A simpler alternative is:
a) No rendering active and no file: render to file, then serve the
B) No rendering active but there is a file: serve the file
C) Rendering active: render to byte array and serve the byte array
(the byte array is needed to set the content length in order to
circumvent an IEx bug)
If the dcontent for the URLs is dynamic, you have to put more thought
into the whole concept.
The PrintRenderer isn't thread safe either. Use with care.