cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <>
Subject Re: webapp and blocks
Date Sun, 17 Feb 2008 12:31:41 GMT
Andre Juffer wrote:
> Hi all,
> Suppose I am building a 'Cargo' application. From a pure Java
> perspective, I would have domain modules such as customers, shipping,
> billing, etc, placed in packages like,
>,, etc. With maven I would create
> a project folder that would contain a single src directory where all the
> packages and resources for this application would go.
> In the case of a cocoon-based (version 2.2) webapp, would it be correct
> to say that the aforementioned domain modules could correspond to
> separate 'blocks', each having their own set of xml, xsl, cforms, flow, 
> java classes, etc files. The Cargo webapp would depend on
> these blocks. The folder structure could look like:
> ./cargo/customers-block
> ./cargo/billing-block
> ./cargo/shipping-block
> ./cargo/cocoon-app (this includes a pom.xml stating the dependency on
> the three other blocks).
> Would this organization conform to what is considered as good practice
> for building a web application with cocoon 2.2?

yes, sounds reasonable.

  What exactly would go to
>  the src folder of the ./cargo/cocoon-app, besides WEB-INF containing
> web.xml, application.context.xml, etc. There are also 
> application.context.xml files in the other blocks. The Carlo application 
> would rely on Spring for bean creation, database access and transaction 
> management.

each block can put its Spring bean definitions into META-INF/cocoon/spring. All 
those beans are loaded into the _global_ Spring bean context.

> Would it make more sense to have a separate block 
> ('classes-resources-block') for all Java classes
> instead of distributing them over the various blocks?

yes but I would want to find a better name that reflects the classes that it 
contains. Too general names usually mean that the architecture needs some 

Apart from that, having a block doesn't necessarily require a Cocoon web 
application with configured servlet services being part of it. It's also a valid 
use case to have blocks that only contain Java resources and Spring beans (e.g. 
for domain specific logic).

Reinhard Pötz                            Managing Director, {Indoqa} GmbH

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message