Hello,
I currently have to design for a requirement as follows-
1. Send report data to a middleware server from a client.
2. Middleware server formats the report data and creates PDF/RTF/plain text documents.
3. Documents need to be sent via Mail or Fax to the desired destination.
The process of creating PDF or
RTF document seems pretty clear - I could use FOP or similar open source APIs for the same.
However, I have a design issue here-
There can be two ways of sending the PDF document as attachment.
a) Temporarily write the PDF document to a temporary .pdf file in the middleware server and then send the attachment using FileDataSource and DataHandler.
b) Use ByteArrayOutputStream to write the PDF document as a byte[] array in the middleware server and then send the attachment using DataHandler directly.
What are the pros and cons of each approach and which would be the preferred solution? Personally I would prefer solution 2 since there might issues in doing file I/O from EJBs, for example. Please remember that the PDF/ RTF document creation takes place in the middleware server itself. The client does not upload these documents to the server.
Regards,
Archanaa