Upayavira wrote:

Sylvain Wallez wrote:

Upayavira wrote:

Sylvain Wallez wrote:

Hi folks,

In one of our projects, we use CocoonBean in a CocoonServlet environment to dump a collection of generated documents on disk. Doing this, we encountered two problems:

- CocoonComponentManager.checkEnvironment barfs and throws an Exception since the servlet environment exists on the stack when the CocoonBean starts its processing.
Obvious solution is to remove this test, as indicated in the method's comments.


I'm okay with it. Although it would be better if the Bean within a servlet could share the Cocoon object, along with all that goes with it. That would make the Bean really quick to start up. I believe Unico had ideas about this.


If the CLI and Servlet environments were sharing the same Cocoon object, the CLI wouldn't load a logkit.xconf and there would therefore be no problem.

But in my particular case, it's better for the two environments not to share the same Cocoon object, as this allows to cleanly separate the application front end (the CocoonServlet) from the publishing part (the CocoonBean).


Does this mean that you have two webapps? I guess my ideal would be one bean per webapp. Is that what you mean by "clean separation"?


Yes: the publication part is run by the CocoonBean in a background thread, and has different components/loggers/sitemaps.

What do you do about the slow startup of the bean? It needs to initialise an entire Cocoon instance before it can do anything. Do you run the bean in the background, or keep a app context bean? Would it help if the bean was known to work in multithreaded environments?


In our case, the startup time of the bean is really negligible compared to the total execution time needed to dump the documents on disk.

Now there are cases where just using the CocoonBean's crawler with the "hosting environment" (the servlet) would be useful. Don't know if its already the case, but for this need we may separate the crawler part from the environment creation part.

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to