You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2004/08/27 11:30:27 UTC

ResourceExists does not work on cocoon: protocol requests?

I'm hacking Forrest so that users can add their documents to the Forrest 
processing.

First of all, from the root sitemap I mount their sitemap in a separate 
uri space if it's found ({project:sitemap} contains the URL to the user 
sitemap):

          <map:match pattern="project_sitemap/**">
            <map:select type="exists">
              <map:when test="{project:sitemap}">
                <map:mount uri-prefix="project_sitemap"
                           src="{project:sitemap}"
                           check-reload="yes" />
              </map:when>
            </map:select>
          </map:match>

Then, in another subsitemap, where Forrest searches for source files, I 
want to see if the user sitemap has an xml file to serve me for the 
current URI, and if so, use it:

       <map:select type="exists">
         <map:when test="cocoon://project_sitemap/{uri}.xml">
           <map:generate src="cocoon://project_sitemap/{uri}.xml" />
           <map:serialize type="xml-document"/>
         </map:when>
          ...etc

The problem is that the test is always true IIUC, and the result is an 
'Attempted to process incomplete pipeline.'

In fact IIUC, in SitemapSource I see:

     /**
      *
      * @see org.apache.excalibur.source.Source#exists()
      */
     public boolean exists() {
         return true;
     }

Any hint if/on how to make this work, or alternatives?
I'm literally _drowning_ in this code.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Re: ResourceExists does not work on cocoon: protocol requests?

Posted by KOZLOV Roman <ro...@opencascade.com>.
I have the same problem for Cocoon 2.1.5.1
Roman

Nicola Ken Barozzi wrote:

> I'm hacking Forrest so that users can add their documents to the Forrest
> processing.
>
> First of all, from the root sitemap I mount their sitemap in a separate
> uri space if it's found ({project:sitemap} contains the URL to the user
> sitemap):
>
>           <map:match pattern="project_sitemap/**">
>             <map:select type="exists">
>               <map:when test="{project:sitemap}">
>                 <map:mount uri-prefix="project_sitemap"
>                            src="{project:sitemap}"
>                            check-reload="yes" />
>               </map:when>
>             </map:select>
>           </map:match>
>
> Then, in another subsitemap, where Forrest searches for source files, I
> want to see if the user sitemap has an xml file to serve me for the
> current URI, and if so, use it:
>
>        <map:select type="exists">
>          <map:when test="cocoon://project_sitemap/{uri}.xml">
>            <map:generate src="cocoon://project_sitemap/{uri}.xml" />
>            <map:serialize type="xml-document"/>
>          </map:when>
>           ...etc
>
> The problem is that the test is always true IIUC, and the result is an
> 'Attempted to process incomplete pipeline.'
>
> In fact IIUC, in SitemapSource I see:
>
>      /**
>       *
>       * @see org.apache.excalibur.source.Source#exists()
>       */
>      public boolean exists() {
>          return true;
>      }
>
> Any hint if/on how to make this work, or alternatives?
> I'm literally _drowning_ in this code.
>
> --
> Nicola Ken Barozzi                   nicolaken@apache.org
>              - verba volant, scripta manent -
>     (discussions get forgotten, just code remains)
> ---------------------------------------------------------------------


Re: ResourceExists does not work on cocoon: protocol requests?

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Vadim Gritsenko wrote:

> Nicola Ken Barozzi wrote:
> 
>> In fact IIUC, in SitemapSource I see:
>>
>>     /**
>>      *
>>      * @see org.apache.excalibur.source.Source#exists()
>>      */
>>     public boolean exists() {
>>         return true;
>>     }
> 
> 
> The problem is that the only way to actually test whether sitemap source 
> exist or not is to try and generate this sitemap resource - which might 
> be expensive operation.

Let's say that I'm clever enough and all of the processing that happens 
without resource generation are (failed) matches. This should be cheap 
enough, as it's the same thing I would do if I do it in the main sitemap 
(which I do not want to do).

How to do it?

[I still remember some time ago when someone wanted to mount sitemaps 
and have processing from the caller continue if no match was found. I 
still remember who was particularly against this thing (errr me), and I 
am now banging my head on solving the same issue. Same thing with the 
handle-errors and the generator in it... the world still didn't fall. 
Gotta remember these things next time I open my big mouth...]

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Re: ResourceExists does not work on cocoon: protocol requests?

Posted by Andreas Hartmann <an...@apache.org>.
Vadim Gritsenko wrote:
> Nicola Ken Barozzi wrote:
> 
>> In fact IIUC, in SitemapSource I see:
>>
>>     /**
>>      *
>>      * @see org.apache.excalibur.source.Source#exists()
>>      */
>>     public boolean exists() {
>>         return true;
>>     }
> 
> 
> The problem is that the only way to actually test whether sitemap source 
> exist or not is to try and generate this sitemap resource - which might 
> be expensive operation.

Hmmm, it seems strange to me to return "true" instead of
doing an expensive operation. Is there any special reason
for that? Or was there an agreement that SitemapSource.exists()
is not well-defined?

-- Andreas


Re: ResourceExists does not work on cocoon: protocol requests?

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Nicola Ken Barozzi wrote:

> In fact IIUC, in SitemapSource I see:
> 
>     /**
>      *
>      * @see org.apache.excalibur.source.Source#exists()
>      */
>     public boolean exists() {
>         return true;
>     }

The problem is that the only way to actually test whether sitemap source 
exist or not is to try and generate this sitemap resource - which might 
be expensive operation.

So, I don't think there is easy solution to this one.

Vadim