Marc Portier wrote:
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?
All attributes that define the sitemap processing flow should be static.
This was decided to prevent the building of dynamic pipelines, and is
used by the TreeProcessor to do some build-time optimizations.
These static attributes are mainly the "name" on instructions (that
choose the component type) and view labels.
The status-code is obviously a good candidate for resolution, and we can
review all attributes to see what others should be resolved as well.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director