cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <...@outerthought.org>
Subject treeprocessor doesn't resolve variables in all attributes of sitemap nodes
Date Mon, 24 Oct 2005 07:21:59 GMT
Hi there,

just found out that
 <map:serialize status-code="{statusCode}" />

kept giving me a statuscode 200 no matter what the value of statusCode was.

as it turns out the SerializeNodeBuilder will in it's buildNode do:
>         this.node = new SerializeNode(
>             type,
>             VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager),
>             VariableResolverFactory.getResolver(config.getAttribute("mime-type", null),
this.manager),
>             config.getAttributeAsInteger("status-code", -1)
>         );

which I read as: @src and @mime-type can but @status-code can-not be
resolved from variables

from an end-user POV this difference in handling is quite arbitrary
(meaning: if there are good considerations for this we should document
them well)


other examples of non-resolvable attributes:

> ./ActionSetNodeBuilder.java:	"name"
> 
> ./ActNodeBuilder.java:	"set"
> ./ActNodeBuilder.java:	"name"
> ./ActNodeBuilder.java:	"src"
> 
> ./CallNodeBuilder.java:	"resource"
> ./CallNodeBuilder.java:	"function"
> ./CallNodeBuilder.java:	"continuation"
> 
> ./HandleErrorsNodeBuilder.java:	"type"
> ./HandleErrorsNodeBuilder.java:	"when"
> 
> ./FlowNodeBuilder.java:	"language"
> 
> ./MatchNodeBuilder.java:	"pattern"
> ./MatchNodeBuilder.java:	"name"
> 
> ./MountNodeBuilder.java:	"check-reload"
> ./MountNodeBuilder.java:	"pass-through"
> 
> ./PipelineNodeBuilder.java:	"internal-only"
> 
> ./RedirectToNodeBuilder.java:	"resource"
> ./RedirectToNodeBuilder.java:	"target"
> ./RedirectToNodeBuilder.java:	"session"
> ./RedirectToNodeBuilder.java:	"global"
> ./RedirectToNodeBuilder.java:	"permanent"
> 
> ./ReadNodeBuilder.java:	"mime-type"
> ./ReadNodeBuilder.java:	"status-code"
> 
> ./SerializeNodeBuilder.java:	"mime-type"
> ./SerializeNodeBuilder.java:	"status-code"
> 
> ./ScriptNodeBuilder.java:    "src"
> 
> ./SitemapLanguage.java:	"logger"
> ./SitemapLanguage.java:	"role"
> ./SitemapLanguage.java:	"class"
> 
> ./ViewNodeBuilder.java:	"from-label"
> ./ViewNodeBuilder.java:	"from-position"


# based on the naieve lookup through
$ cd  src/java/org/apache/cocoon/components/treeprocessor/sitemap/;
$ find -type f |xargs grep 'config\.get' | grep -v '\.svn' | grep -v
VariableResolverFactory > ~/UnresolvedSitemapAttributes.txt


anyone any opinion on these?

maybe it makes sense to look at these with our "rule of least
surprise"-glasses on?

regards,
-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org

Mime
View raw message