cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <craft...@dresdnerbank.de>
Subject Matchers and Selectors (was Re: Better and Better and RT)
Date Thu, 09 Nov 2000 19:23:18 GMT
Hi Giacomo,

On Sun, 5 Nov 2000, Giacomo Pati wrote:

> Ross Burton wrote:
> > 
> > Berin Loritsch wrote:
> > >
> > > I envision the following additional selectors to be vital
> > > to any site:
> > >
> > > ParameterSelector (select things pased on HTTP parameters)
> > > AcceptsSelector (send PNG to browsers that accept it...)
> 
> Take into account that a Selector chooses between multiple possibilities
> (and a default one if neither choosen) whereas a Matcher returns a List
> (or maybe we should change that to a Map) of values you can use for
> substitution in src attributes of Generators and Transformers. I can
> imaging to have a Matcher that select values out of the environment
> objects (Request/Response/Session/Context) and a corresponsing Selector
> which chooses some component to generate the view expected. This way you
> can still refer to the values the Matcher has evaluated.
> 
>   <match type="uri" pattern="myuri">
>     <match type="value-extractor" pattern="unused">    <-----+
>       <select type="value-selector">                         !
>         <when test="first">                                  !
>           <generate type="file" src="mydir/first/{value}/> --+
>         </when>
>         ...
>       </select>
>     </match>
>   </match>
> 
> I really think that we must think in terms of "team play" between
> components. What do you think about that?

	I like the idea of having the selector working with the matcher. But I
	think I'm getting myself confused between the uses of matchers and
	selectors. :-(

	My understanding is that a 'matcher' is used to match something
	against the current request and a specific parameter passed to the
	matcher. 'Selectors' on the other hand are used to test the current
	request for particular values.

	I wrote the RequestParamMatcherFactory which I posted a couple of days
	back, and are now writing a ParameterSelectorFactory - what i want to
	do is to be able to tell the selector which request parameter it
	should be testing - but from what I can see, the selector interface
	doesn't support parameters like matchers do ?

	For example:

	<select type="paramselector" param="myparameter">
	  <when test="on">
	    ...
	  </when>
	</select>

	Where 'myparameter' is the what should be passed to
	request.getParameter(); in the generated paramselector code.

	How can something like this be implemented ? Selectors seem to be
	designed to use a predefined parameter to select a value from a
	defined set. What if we want to vary that parameter ?
	
	I could set all of the 'param's in the declaration of the selector in
	the selection section of the sitemap (hows that for a tounge
	twister!), but then there's problems if 2 or more request parameters
	are used at the same time.

	Any ideas ? or have I totally misunderstood everything! :-)

	Cheers,

	Marcus
-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750




Mime
View raw message