cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ross Burton" <ross.bur...@mail.com>
Subject Re: sitemap draft still needs work in the matcher/chooser area
Date Sun, 18 Jun 2000 10:12:05 GMT

> 2. exactly how is the choose/when stuff supposed to work? i see that the
> type attribute of the choose tag indicates which chooser is assigned to
> test the condition, but what happens then? should the chooser API look
> something like this:
>
> boolean choose(Request request, String test);
>
> where test is the value of the test attribute of the when element? what
> form are the test expressions allowed to take? they look an awful lot like
> XPath expressions to me... :)

If I recall correctly (unless it changed overnight) if the Cocoon found this
in the sitemap:

    <choose type="browser">
        <when test="accepts('image/svg')">
            ...
        </when>
        <default>
            ...
        </default>
    </choose>

It calls the method "accepts" using reflection with the string argument
"image/svg" on the Chooser called "browser" which was loaded as a Component.

However, the lack of a interface actually defining any methods could be seen
as a problem, so Choose could define :

    public boolean choose(String test, String argument);

And the sitemap would work by calling:

    Choose b = manager.getComponent("browser");
    b.choose("accepts", "image/svg");

Which gives the Chooser inteface something concrete to work on - beginners
to Cocoon matchers, sorry Choosers, may miss the point that dynamic method
calls are being made.

Ross Burton


Mime
View raw message