...
> 
> Let's worry less about perfection and worry more about some simple 
> changes that have huge payoffs.  Once we have the basics down, we can 
> tackle some of the more difficult aspects.
> 

Okay, but does that really need a completely new sitemap implementation?

> The convention is {context}/{controller}/{action}[/{id}]

Well (assuming this sitemap was mounted for the context):

<map:match pattern="*/*/*">
  <map:call function="handleControllerCall">
    <map:parameter name="controller" value="{1}"/>
    <map:parameter name="action" value="{2}"/>
    <map:parameter name="id" value="{3}"/>
  </map:call>
</map:match>
<map:match pattern="*/*">
  <map:call function="handleControllerCall">
    <map:parameter name="controller" value="{1}"/>
    <map:parameter name="action" value="{2}"/>
  </map:call>
</map:match>

The "handleControllerCall" function can be written in flowscript or even use 
the great new java flow as shown by Torsten Curdt during the get together. Not 
sure how that class reloading works, but if you put the controller classes in 
the same path, I guess the reloading feature would work there as well. So, you 
can do something like...:

if(action==null) action="index";
contr = 
Package.org.apache.cocoon.util.ClassUtils.newInstance("controllers."+controller+"Controller");

if(id==null)
  contr[action]();
else
  contr[action](id); //well, a little more processing here to get the object 
with this id first

cocoon.sendPage("views/"+controller+"/"+action);

Right?

max

Reply via email to