You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fred Vos <fr...@planet.nl> on 2005/12/13 12:47:21 UTC

How to configure the location of external services in the sitemap

Hello,

At work we are working on a Cocoon application that uses http requests in
generators. The base URLs in these requests differ for each instance of our
application. We don't want people to edit the sitemap to change URLs of these
external services, everytime the sitemap changes. During development we also
want to keep our local configuration.

Furthermore we generate links to external services and these links also differ
for each instance of the application.

A simple approach is to generate a sitemap.xmap file using a template file for
the sitemap and an XML document containing a list of external services. A
simple XSLT script can transform the template sitemap file into a sitemap
file.

This requires regenerating the sitemap file after changing either the sitemap
template or the file with base-URLs.

For generating links, the XML document with base URLs can be used in the XSL
script that generates HTML.

Maybe there are better ways to solve this problem. If anyone has a good
solution and scripts available, please let me know.

Fred

-- 
|E  R
| D  F
|
|fred at fredvos dot org
|5235 DG 52 NL +31 73 6411833

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to configure the location of external services in the sitemap

Posted by Fred Vos <fr...@planet.nl>.
On Tue, Dec 13, 2005 at 12:49:34PM +0100, Geert Josten wrote:
> Here is a simple alternative:
> 
> Use input modules to insert the application specific base urls. Something 
> like:
> 
> <map:generate src="{my-config:base-url}/my-query.xml" />
> 
> You have several default input modules at your disposal, for reading 
> properties files, xml, etc. You can define them locally in your sitemap by 
> the way..
> 
> Regards,
> Geert

Thank you, Geert. It works. I created an entry in WEB-INF/cocoon.xconf:

    <component-instance
      class="org.apache.cocoon.components.modules.input.XMLFileModule"
      logger="core.modules.input"
      name="pprotoconf">
      <file src="context://pproto/conf.xml"/>
    </component-instance>

and a file called 'conf.xml' in the tomcat5/webapps/cocoon/pproto directory
(URLs and names of services changed for this example):

<?xml version="1.0"?>
<conf>
  <service1>http://host.domain.org:port/path/service1</service1>
  <service2>http://anotherhost.anotherdomain.org/path/service2</service2>
</conf>

In the sitemap I could then use references like:

      <map:parameter name="srv1" value="{pprotoconf:/conf/service1}"/>

where 'pprotoconf' in '{pprotoconf:/conf/service1}' references the the name
attribute of the component-instance and '/conf/service1' is an XPath
expression.

Regards,

Fred Vos

> 
> Fred Vos wrote:
> 
> >Hello,
> >
> >At work we are working on a Cocoon application that uses http requests in
> >generators. The base URLs in these requests differ for each instance of our
> >application. We don't want people to edit the sitemap to change URLs of 
> >these
> >external services, everytime the sitemap changes. During development we 
> >also
> >want to keep our local configuration.

[...]

-- 
|E  R
| D  F
|
|fred at fredvos dot org
|5235 DG 52 NL +31 73 6411833

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to configure the location of external services in the sitemap

Posted by Geert Josten <Ge...@daidalos.nl>.
Here is a simple alternative:

Use input modules to insert the application specific base urls. Something like:

<map:generate src="{my-config:base-url}/my-query.xml" />

You have several default input modules at your disposal, for reading properties files, xml, etc. You 
can define them locally in your sitemap by the way..

Regards,
Geert

Fred Vos wrote:

> Hello,
> 
> At work we are working on a Cocoon application that uses http requests in
> generators. The base URLs in these requests differ for each instance of our
> application. We don't want people to edit the sitemap to change URLs of these
> external services, everytime the sitemap changes. During development we also
> want to keep our local configuration.
> 
> Furthermore we generate links to external services and these links also differ
> for each instance of the application.
> 
> A simple approach is to generate a sitemap.xmap file using a template file for
> the sitemap and an XML document containing a list of external services. A
> simple XSLT script can transform the template sitemap file into a sitemap
> file.
> 
> This requires regenerating the sitemap file after changing either the sitemap
> template or the file with base-URLs.
> 
> For generating links, the XML document with base URLs can be used in the XSL
> script that generates HTML.
> 
> Maybe there are better ways to solve this problem. If anyone has a good
> solution and scripts available, please let me know.
> 
> Fred
> 

-- 
Drs. G.P.H. Josten
Consultant



Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is 
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken 
wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to configure the location of external services in the sitemap

Posted by Ross Gardler <rg...@apache.org>.
Fred Vos wrote:
> At work we are working on a Cocoon application that uses http requests in
> generators. The base URLs in these requests differ for each instance of our
> application. We don't want people to edit the sitemap to change URLs of these
> external services, everytime the sitemap changes. During development we also
> want to keep our local configuration.
> 
> Furthermore we generate links to external services and these links also differ
> for each instance of the application.
> 
> A simple approach is to generate a sitemap.xmap file using a template file for
> the sitemap and an XML document containing a list of external services. A
> simple XSLT script can transform the template sitemap file into a sitemap
> file.
> 
> This requires regenerating the sitemap file after changing either the sitemap
> template or the file with base-URLs.
> 
> For generating links, the XML document with base URLs can be used in the XSL
> script that generates HTML.
> 
> Maybe there are better ways to solve this problem. If anyone has a good
> solution and scripts available, please let me know.

Over in the Forrest project we have an InputModule called a locationmap 
[1].

This will be ideal for your problem. You can either create a locationmap 
for each individidual deployment of your application, or you can 
dynamically create it at runtime.

Although this is a part of Forrest, you can easily lift the required 
source files for your project if you don't want to use the whole of 
Forrest. It would be great to se this code moved into a Cocoon block to 
facilitate its reuse in projects such as yours. We'd be happy to help 
you identify the bits you need via the Forrest mailing lists [2]. (I 
can't guarentee to see you mails here, I don't read as this list as 
closely as the Forrest ones)

Ross

[1] http://forrest.apache.org/docs_0_80/locationmap.html
[2] http://forrest.apache.org/mail-lists.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org