> 
> thanks Ard.
> 
> well.. the use-request-parameters was just an example.
> actually, I am writing a reader and I dont want to hardcode a 
> value. So, 
> thot of passing it from sitemap.

well, for exampla in your sitemap components you define your default settings 
like:

<map:reader logger="sitemap.reader.image" name="image" pool-grow="4" 
pool-max="32" pool-min="1" src="org.apache.cocoon.reading.ImageReader">
    <parameter name="expires" value="86400000"/> // 1 day
</map:reader>

This ImageReader extends the ResourceReader, that for example has in its 
configure the following line:

this.configuredExpires = parameters.getParameterAsLong("expires", -1);


Now, when you actually use the ImageReader in a pipeline matcher, for example, 

<map:match pattern="readtest">
        <map:read src="/foo.gif" type="image">
                <map:parameter name="expires" value="60"/>
        </map:read>
        
Now, if in the setup method you have for example, 

this.expires = par.getParameterAsLong("expires", this.configuredExpires);

it means that this specific matcher, you have defined a specific expires, and 
therefor, you dont take the default configuredExpires, right?

So, if you would have 


<map:match pattern="readtest">
        <map:read src="/foo.gif" type="image">
        </map:read>

you would get the default expires configured.

and with 


<map:match pattern="readtest">
        <map:read src="/foo.gif" type="image">
                <map:parameter name="expires" value="120"/>
        </map:read>

you would get 2 minutes expires on what you read instead of 60 sec or 86400000 
secs..

Ard

> 
> So, where in the sitemap shud I be putting this value and 
> where in the 
> reader code shud I be reading it?
> 
> thanks
> 
> -S.
> 
> 
> 
> >From: "Ard Schrijvers" <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: <[email protected]>
> >Subject: RE: difference betn configuration and parameters
> >Date: Thu, 12 Oct 2006 20:28:48 +0200
> >
> >Hello,
> > >
> > >
> > > Hi,
> > >
> > > I was looking at some of the cocoon source-code that has some
> > > configurable
> > > entries in the sitemap
> > > (eg: ResourceReader, TraxTransformer etc.)
> > >
> > > in the configure method, it retreives the entry from 
> sitemap in the
> > > following way,
> > >
> > > Configuration child;
> > > child = conf.getChild("use-request-parameters");
> > > this.useParameters = child.getValueAsBoolean(false);
> > > this._useParameters = this.useParameters;
> >
> >Configuration typically is called during configure of the component 
> >(happens already at cocoon start-up, also see 
> >http://excalibur.apache.org/framework/lifecycle.html). You 
> can see this 
> >configuration (in cocoon.xconf) of the component as "global" default 
> >configuration of your component. (configure is only called once per 
> >instance of the component...I think :-)  ).
> >
> >Now, calling a pipeline using this component, like the 
> TraxTransformer runs 
> >the setup method. During setup, typically, you can override default 
> >component behavior, like setting use-request-parameters to 
> another value.
> >
> >I don't think you will freq use this for the 
> TraxTransformer, but for 
> >example for readers it is very common, to define one default 
> reader in 
> >components in the sitemap with some expires value, and then, 
> in specific 
> >matchers override this default value.
> >
> >Then, I want to end with my evangelistic remark (I did not 
> count, but there 
> >must be many) : For the TraxTransformer, never never ever set 
> >user-request-parameters to true!!
> >
> >Regards Ard
> >
> > >
> > > and again, in the setup method,
> > >
> > > _useParameters = 
> par.getParameterAsBoolean("use-request-parameters",
> > > this.useParameters);
> > >
> > > ----------
> > > whats the difference between the two???
> > > why should we do it 2 times???
> > >
> > > thanks
> > >
> > > -S.
> > >
> > > _________________________________________________________________
> > > Share your special moments by uploading 500 photos per month
> > > to Windows Live
> > > Spaces
> > > http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?h
> > > ref=http://www.get.live.com/spaces/features
> > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> _________________________________________________________________
> Express yourself - download free Windows Live Messenger themes! 
> http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?h
ref=http://imagine-msn.com/themes/vibe/default.aspx?locale=en-us&source=hmtagline


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to