Hi,

I am working on a Tapestry application that has over hundreds Tapestry HTML
pages, all sharing one single Java class file. These Tapestry HTML pages are
submitted by users from time to time ... so they are not immediately in the
web application, and they may change from time to time.

The thing is, I would like to render these Tapestry pages into files
(instead of normally output the the HTTP stream). I have thought of 3 ways
of doing this, but I feel they may not be the right way or maybe not
possible, ... so wonder if more experience Tapestry guys here can give some
advice.

(Method 1) The Tapestry HTML pages submitted by users are put into web
accessible directory in the web application. Then access the file using
libraries such as Apache Common HttpClient from the web application itself,
then save the output stream data, and write them to files.

This approach has one problem. Since the Tapestry HTML pages are cached by
Tapestry, and user may submit modified Tapestry HTML pages (with the same
filename) in the future, these modified Tapestry HTML pages will not be
loaded anymore. I could still clear the Tapestry cache, but that would clear
the cache for the whole web application (something not desired).

So I feel this approach is probably the least possible.

(Method 2) Instantiate a separate 'Tapestry rendering engine' inside the web
application. Use the object to render the user submitted Tapestry HTML pages
and save the output to files.

Is this possible? How to do it? I tried to trace into the Tapestry source
code, but the complexity of PageLoader is just beyond me. It seems to
be tightly tied into Tapestry as a whole.

Then again, how possible is it? I kinda feel this is the best way. Am I on
the right path?

(Method 3) Write my own rendering engine. Since the user submitted Tapestry
HTML Pages will only use minimum set of Tapestry components such as Insert,
TextInsert, and For (these can be made a requirement). So essentially, I
will have dom4j read the HTML structure, and replace the appropriate data
where 'jwcid' appears. And finally write the processed DOM into files.


If you have read until here for this long post, thank you very much :) Any
hint and pointers will be greatly appreciated.

~KEGan

Reply via email to