You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de> on 2002/06/25 11:24:29 UTC

Re: Sitemap parameters from servlet init (e.g. from outside the s itemap)...

On 25.Jun.2002 -- 12:47 PM, Piroumian Konstantin wrote:
> > > - in Cocoon, does something already exist to get set sitemap 
> > > parameters from somewhere 'global' (hopefully from the init params)?
> > 
> > Or perhaps to/from the servlet context?
> 
> There is a new thing in CVS HEAD called InputModules. I think that this is
> what you are looking for. You can create an input module for servlet context
> attributes (or wait a little -  I think it will be available soon) and use
> it like this in your sitemap:
> 
> <map:generate src="http://{app:server-port}/bin/get?foo" />
> 
> There is also another new thing in sitemap syntax, called
> 'global-parameters':
> <map:pipelines>
>   <map:global-parameters>
>     <map:parameter name="servlet-port" value="8080" />
>  ...
> 
>    <map:generate src="http://{../server-port}/bin/get?foo" />
> 
> But AFAIK they can be set only from the mounting sitemap, so you'll have to
> change your sitemaps anyway.

Global parameters can be done with input modules as well. See
the DefaultsMetaModule: 

   <input-modules logger="core.modules.input">
      <component-instance class="org.apache.cocoon.components.modules.input.DefaultsMetaModule" name="defaults">
		 <input-module name="request"/>
		 <values>
			<skin>defaultSkin</skin>
			<base-url>http://localhost:8080/cocoon</base-url>
		 </values>
	  </component-instance>
   </input-modules>

Declarable anywhere you can declare components (cocoon.xconf and
sitemap.xmap in map:components block)

This way you don't have to calculate the number of "../"'s and just
refer to them via "{defaults:skin}". :-)
Plus you can use it anywhere you can use modules (currently a matcher
plus all "new" database actions). 
Plus the value can be overridden with any other input module (here:
request parameters).
Plus you can have any number of the above using different names.
Plus writing input modules is trivial.
Plus there're already docs about it in HEAD.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>