cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject [PROPOSAL] Block conventions
Date Wed, 14 Mar 2007 13:18:23 GMT

I would like to propose some conventions in block's structure. I mean here a structure that
matters on sitemap level not
on the lower levels (servlet-fw, packaging, etc.). I think we should advise some guidelines
when it comes to the
exposing resources and services to the outside world.

That said I propose to have following URI spaces:
* resource/external/** - resources in this space are meant to be accessible from the outside
of Cocoon. It would be
mainly a CSS/JS, etc content.
* resource/internal/** - this resources would be only accessible from other blocks/servlets
mounted in Cocoon's
instance. They would mainly consist of XSLT, XML, JX files that one block likes to expose
to the others.
* service/** - pipelines in this URI space would be only those which can consume POSTable
requests. In short, here would
all block's servlet services services be exposed.

Accordingly, following directory structure would be advised:
<block's context>
  * resource
      * external
      * internal

Also we should reflect this in sitemap created by archetype:
<map:pipeline id="internal-resource" internal-only="true">
  <map:match pattern="resource/internal/**">
    <map:read src="resource/internal/{1}"/>

<map:pipeline id="external-resource">
  <map:match pattern="resource/external/javascript/**">
    <!-- Usage of this reader guarantees that all possible links in JS are properly handled
    <map:read src="resource/external/javascript/{1}" type="servletLinkRewriter">
  <map:match pattern="resource/external/**">
    <map:read src="resource/external/{1}"/>

<map:pipeline id="service">
  <!-- put your service pipelines here -->

I think that following "convention over configuration" here is really good idea and most users
will take this advice. It
help newcomers to focus on actual work, and it will help block's ecosystem because standardized
URI spaces facilitate
block's cooperation.

Comments? Thoughts? Anyone objecting?

Grzegorz Kossakowski

View raw message