You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ross Burton <ro...@mail.com> on 2000/06/15 10:18:20 UTC

[C2] Sitemap and Request parameters

Hi,

I really should get some sleeping pills - I cannot sleep at the moment and
end up laying in bed thinking about everything...

Suppose I am running a news web site on Cocoon 2.  Being sensible it is
possible to access any days news by entering the correct URL, for example
http://www.groovynews.com/2000/06/15/ will show the news for today.
Obviously XSP is going to be used here to retreive the data.

At the moment, I can see this working by the XSP code breaking the URL down
into components, validating it and using the individual values to build a
query.  But why should the XSP know the URL structure?  I think it should
just work from parameters in the request, something like this: (in a mix of
sitemap languages)

<process match="/\([0-9]\{4\}\)/\([0-9]\{2\}\)/\([0-9]\{2\}\)/">
    <set-parameter name="year" value="$1"/>
    <set-parameter name="month" value="$2"/>
    <set-parameter name="day" value="$3"/>

    <generator name="serverpages" src="/dailynews.xsp">
    <!-- filters -->
    <serializer type="html"/>
</process>

(anybody know a syntax-highlighted regexp editor!?)

The XSP code build queries based on the values of year, month and day; which
are in the Request object.  These variables are also available in the XSLT
phase.  The regexp also handles validation of the URL - it must be
/xxxx/xx/xx where x is 0-9.

Is this a good idea? Or just FS?

Ross Burton


Re: [C2] Sitemap and Request parameters

Posted by Stefano Mazzocchi <st...@apache.org>.
Ross Burton wrote:
> 
> Hi,
> 
> I really should get some sleeping pills - I cannot sleep at the moment and
> end up laying in bed thinking about everything...
> 
> Suppose I am running a news web site on Cocoon 2.  Being sensible it is
> possible to access any days news by entering the correct URL, for example
> http://www.groovynews.com/2000/06/15/ will show the news for today.
> Obviously XSP is going to be used here to retreive the data.
> 
> At the moment, I can see this working by the XSP code breaking the URL down
> into components, validating it and using the individual values to build a
> query.  But why should the XSP know the URL structure?  I think it should
> just work from parameters in the request, something like this: (in a mix of
> sitemap languages)
> 
> <process match="/\([0-9]\{4\}\)/\([0-9]\{2\}\)/\([0-9]\{2\}\)/">
>     <set-parameter name="year" value="$1"/>
>     <set-parameter name="month" value="$2"/>
>     <set-parameter name="day" value="$3"/>
> 
>     <generator name="serverpages" src="/dailynews.xsp">
>     <!-- filters -->
>     <serializer type="html"/>
> </process>
> 
> (anybody know a syntax-highlighted regexp editor!?)
> 
> The XSP code build queries based on the values of year, month and day; which
> are in the Request object.  These variables are also available in the XSLT
> phase.  The regexp also handles validation of the URL - it must be
> /xxxx/xx/xx where x is 0-9.
> 
> Is this a good idea? Or just FS?

Wow, I think this is great!

Yeah, I do see the risk of getting into FS, but this would allow better
"adaptation" of external generators to different URI schemes.

+1

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



RE: [C2] Sitemap and Request parameters

Posted by David Duddleston <da...@i2a.com>.
I would love to see sitemap do this. Currently, my own implementation of
sitemap (no relation to C2 sitemap) does this. It finds a match, dissects
the URL and then calls the appropriate component with the parameters. It is
nothing special and to be honest, I just hacked it together, but it would be
very nice to replace this function with sitemap when I move my sites to use
C2.

-david

> -----Original Message-----
> From: Ross Burton [mailto:ross.burton@mail.com]
> Sent: Thursday, June 15, 2000 1:18 AM
> To: Cocoon Development
> Subject: [C2] Sitemap and Request parameters
>
>
> Hi,
>
> I really should get some sleeping pills - I cannot sleep at the moment and
> end up laying in bed thinking about everything...
>
> Suppose I am running a news web site on Cocoon 2.  Being sensible it is
> possible to access any days news by entering the correct URL, for example
> http://www.groovynews.com/2000/06/15/ will show the news for today.
> Obviously XSP is going to be used here to retreive the data.
>
> At the moment, I can see this working by the XSP code breaking
> the URL down
> into components, validating it and using the individual values to build a
> query.  But why should the XSP know the URL structure?  I think it should
> just work from parameters in the request, something like this:
> (in a mix of
> sitemap languages)
>
> <process match="/\([0-9]\{4\}\)/\([0-9]\{2\}\)/\([0-9]\{2\}\)/">
>     <set-parameter name="year" value="$1"/>
>     <set-parameter name="month" value="$2"/>
>     <set-parameter name="day" value="$3"/>
>
>     <generator name="serverpages" src="/dailynews.xsp">
>     <!-- filters -->
>     <serializer type="html"/>
> </process>
>
> (anybody know a syntax-highlighted regexp editor!?)
>
> The XSP code build queries based on the values of year, month and
> day; which
> are in the Request object.  These variables are also available in the XSLT
> phase.  The regexp also handles validation of the URL - it must be
> /xxxx/xx/xx where x is 0-9.
>
> Is this a good idea? Or just FS?
>
> Ross Burton
>