You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by simon litwan <si...@wyona.com> on 2005/03/24 11:47:22 UTC

ResourceNotFoundException if missing

hello 

if there is the meta file missing for an asset, i get a
ResourceNotFoundException. i thought i could find the problem in the
file includeAssetMetaData.xsl. but there is ignoreErrors set to true
where i think the metadata gets included. 
does somebody know why it still throws an error? 
are there other files involved in this?

thanks
simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by simon litwan <si...@wyona.com>.
> On Tue, 12 Apr 2005, simon litwan wrote:
> 
> > > On Tue, 12 Apr 2005, Michael Wechner wrote:
> > >
> > > > Felix Röthenbacher wrote:
> > > >
> 
> [ ... ]
> 
> > >
> > > I am not quite sure but you can use something like:
> > >
> > > <cinclude:includexml ignoreErrors="true">
> > >    <cinclude:src>{$metaFileURI}</cinclude:src>
> > > </cinclude:includexml>
> > >
> > > instead of:
> > >
> > > <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
> > >
> > > In that case there is at least no error thrown.
> > >
> > > Jann
> >
> > now i think i'm on a bad track at all. the publication i'm working on
> > doesn't have any cinclude-tags. so i'm still searching from where the
> > match pattern="**.meta" in the doctypes.xmap gets called. my idea was to
> > test for existence and block the request for the *.meta before it comes
> > to the point lenya misses the *.meta.
> > but maybe i'm totally misled.
> 
> I am not sure wheter i really understand your problem but  if you use
> <cinclude:includexml ignoreErrors="true"> as described above the error due
> to a missing *.meta file is gone because the attribute ignoreErrors is
> supported.
> If you work with the unicms publication the *.meta file is included in
> lenya/pubs/unizh/xslt/includeAssetMetaData.xsl and the xsl File is
> referenced in:
> 
> <map:transform src="../unizh/xslt/includeAssetMetaData.xsl"
> label="aggregation">
>           <map:parameter name="documentid"
> value="{page-envelope:document-id}"/>
>             </map:transform>
>         <map:transform type="cinclude"/>
> 
> in doctypes.xmap
> 
> HTH
> 
> Jann

thanks jann
i think that works. i changed includeAssetMetaData.xsl as described
above and now there is no error.

thanks
simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Tue, 12 Apr 2005, simon litwan wrote:

> > On Tue, 12 Apr 2005, Michael Wechner wrote:
> >
> > > Felix Röthenbacher wrote:
> > >

[ ... ]

> >
> > I am not quite sure but you can use something like:
> >
> > <cinclude:includexml ignoreErrors="true">
> >    <cinclude:src>{$metaFileURI}</cinclude:src>
> > </cinclude:includexml>
> >
> > instead of:
> >
> > <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
> >
> > In that case there is at least no error thrown.
> >
> > Jann
>
> now i think i'm on a bad track at all. the publication i'm working on
> doesn't have any cinclude-tags. so i'm still searching from where the
> match pattern="**.meta" in the doctypes.xmap gets called. my idea was to
> test for existence and block the request for the *.meta before it comes
> to the point lenya misses the *.meta.
> but maybe i'm totally misled.

I am not sure wheter i really understand your problem but  if you use
<cinclude:includexml ignoreErrors="true"> as described above the error due
to a missing *.meta file is gone because the attribute ignoreErrors is
supported.
If you work with the unicms publication the *.meta file is included in
lenya/pubs/unizh/xslt/includeAssetMetaData.xsl and the xsl File is
referenced in:

<map:transform src="../unizh/xslt/includeAssetMetaData.xsl"
label="aggregation">
          <map:parameter name="documentid"
value="{page-envelope:document-id}"/>
            </map:transform>
        <map:transform type="cinclude"/>

in doctypes.xmap

HTH

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by simon litwan <si...@wyona.com>.
> On Tue, 12 Apr 2005, Michael Wechner wrote:
> 
> > Felix Röthenbacher wrote:
> >
> > >>
> > >> i'm not shure but i think it would be better there is no error and NO
> > >> dummy.meta. i think it does'nt make much sense this dummy.meta because
> > >> there is no relevant information in it. it would'nt make any difference
> > >> without this information.
> > >
> > >
> > > You have to assure that cinclude:include is never called for a
> > > non-existing resource
> >
> >
> > doesn't cinclude support a fallback? I thought it does or is only
> > xinclude supporting a fallback ...
> >
> 
> I am not quite sure but you can use something like:
> 
> <cinclude:includexml ignoreErrors="true">
>    <cinclude:src>{$metaFileURI}</cinclude:src>
> </cinclude:includexml>
> 
> instead of:
> 
> <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
> 
> In that case there is at least no error thrown.
> 
> Jann

now i think i'm on a bad track at all. the publication i'm working on
doesn't have any cinclude-tags. so i'm still searching from where the
match pattern="**.meta" in the doctypes.xmap gets called. my idea was to
test for existence and block the request for the *.meta before it comes
to the point lenya misses the *.meta.
but maybe i'm totally misled.
cheers
simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by simon litwan <si...@wyona.com>.
> > > > I am not quite sure but you can use something like:
> > > >
> > > > <cinclude:includexml ignoreErrors="true">
> > > >    <cinclude:src>{$metaFileURI}</cinclude:src>
> > > > </cinclude:includexml>
> > > >
> > > > instead of:
> > > >
> > > > <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
> > >
> > > @Michi:
> > > The ignoreErrors directive is ignored in cinclude:include,
> > > viz. not supported ;-)


hi all

just for the record.

it should be like this:
      <cinclude:includexml ignoreErrors="true">
       <cinclude:src>
         <xsl:value-of select="$metaFileURI"/>
       </cinclude:src>
      </cinclude:includexml>

not like this

<cinclude:includexml ignoreErrors="true">
    <cinclude:src>{$metaFileURI}</cinclude:src>
 </cinclude:includexml>

thanks to edith

simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by simon litwan <si...@wyona.com>.
> > >
> > >
> > > I am not quite sure but you can use something like:
> > >
> > > <cinclude:includexml ignoreErrors="true">
> > >    <cinclude:src>{$metaFileURI}</cinclude:src>
> > > </cinclude:includexml>
> > >
> > > instead of:
> > >
> > > <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
> >
> > @Michi:
> > The ignoreErrors directive is ignored in cinclude:include,
> > viz. not supported ;-)
> >
> > So maybe someone want to remove all ignoreErrors in the cinclude:include
> > tags because it's misleading ...
> >
> Or you replace <cinclude:include.... with  <cinclude:includexml... where
> possible. In the unicms publication it is certainly better this way
> otherwise you will get an error as soon as you delete an asset which is
> still referenced to in the respective page which is certainly bad from a
> user point of view.
> 
> Jann

i just replaced the <cinclude:include.... with  <cinclude:includexml (as
you described above) in the 2 includeAssetMetaData.xsl i found in the
unicms (in unizh and eltemplate). i'll commit it now.

simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Tue, 12 Apr 2005, Felix Röthenbacher wrote:

> Jann Forrer wrote:
> > On Tue, 12 Apr 2005, Michael Wechner wrote:
> >
> >
> >>Felix Röthenbacher wrote:
> >>
> >>
> >>>>i'm not shure but i think it would be better there is no error and NO
> >>>>dummy.meta. i think it does'nt make much sense this dummy.meta because
> >>>>there is no relevant information in it. it would'nt make any difference
> >>>>without this information.
> >>>
> >>>
> >>>You have to assure that cinclude:include is never called for a
> >>>non-existing resource
> >>
> >>
> >>doesn't cinclude support a fallback? I thought it does or is only
> >>xinclude supporting a fallback ...
> >>
> >
> >
> > I am not quite sure but you can use something like:
> >
> > <cinclude:includexml ignoreErrors="true">
> >    <cinclude:src>{$metaFileURI}</cinclude:src>
> > </cinclude:includexml>
> >
> > instead of:
> >
> > <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>
>
> @Michi:
> The ignoreErrors directive is ignored in cinclude:include,
> viz. not supported ;-)
>
> So maybe someone want to remove all ignoreErrors in the cinclude:include
> tags because it's misleading ...
>
Or you replace <cinclude:include.... with  <cinclude:includexml... where
possible. In the unicms publication it is certainly better this way
otherwise you will get an error as soon as you delete an asset which is
still referenced to in the respective page which is certainly bad from a
user point of view.

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Felix Röthenbacher <fe...@wyona.com>.
Jann Forrer wrote:
> On Tue, 12 Apr 2005, Michael Wechner wrote:
> 
> 
>>Felix Röthenbacher wrote:
>>
>>
>>>>i'm not shure but i think it would be better there is no error and NO
>>>>dummy.meta. i think it does'nt make much sense this dummy.meta because
>>>>there is no relevant information in it. it would'nt make any difference
>>>>without this information.
>>>
>>>
>>>You have to assure that cinclude:include is never called for a
>>>non-existing resource
>>
>>
>>doesn't cinclude support a fallback? I thought it does or is only
>>xinclude supporting a fallback ...
>>
> 
> 
> I am not quite sure but you can use something like:
> 
> <cinclude:includexml ignoreErrors="true">
>    <cinclude:src>{$metaFileURI}</cinclude:src>
> </cinclude:includexml>
> 
> instead of:
> 
> <cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>

@Michi:
The ignoreErrors directive is ignored in cinclude:include,
viz. not supported ;-)

So maybe someone want to remove all ignoreErrors in the cinclude:include
tags because it's misleading ...

- Felix

> 
> In that case there is at least no error thrown.
> 
> Jann
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Tue, 12 Apr 2005, Michael Wechner wrote:

> Felix Röthenbacher wrote:
>
> >>
> >> i'm not shure but i think it would be better there is no error and NO
> >> dummy.meta. i think it does'nt make much sense this dummy.meta because
> >> there is no relevant information in it. it would'nt make any difference
> >> without this information.
> >
> >
> > You have to assure that cinclude:include is never called for a
> > non-existing resource
>
>
> doesn't cinclude support a fallback? I thought it does or is only
> xinclude supporting a fallback ...
>

I am not quite sure but you can use something like:

<cinclude:includexml ignoreErrors="true">
   <cinclude:src>{$metaFileURI}</cinclude:src>
</cinclude:includexml>

instead of:

<cinclude:include src="{$metaFileURI}" ignoreErrors="true"/>

In that case there is at least no error thrown.

Jann


---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich

oooO   mail:  jann.forrer@id.unizh.ch
(  )   phone: +41 1 63 56772
 \ (   fax:   +41 1 63 54505
  \_)  http://www.id.unizh.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Michael Wechner <mi...@wyona.com>.
Felix Röthenbacher wrote:

>>
>> i'm not shure but i think it would be better there is no error and NO
>> dummy.meta. i think it does'nt make much sense this dummy.meta because
>> there is no relevant information in it. it would'nt make any difference
>> without this information.
>
>
> You have to assure that cinclude:include is never called for a
> non-existing resource 


doesn't cinclude support a fallback? I thought it does or is only
xinclude supporting a fallback ...

Michi

-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Felix Röthenbacher <fe...@wyona.com>.
simon litwan wrote:
>>>if there is the meta file missing for an asset, i get a
>>>ResourceNotFoundException. i thought i could find the problem in the
>>>file includeAssetMetaData.xsl. but there is ignoreErrors set to true
>>>where i think the metadata gets included. 
>>>does somebody know why it still throws an error? 
>>>are there other files involved in this?
>>
>><cinclude:include .../> does not support that directive,
>><cinclude:includexml .../> does.
>>
>>A solution would be to create a general meta data file dummy.meta in
>>resources/shared and change the code in doctypes.xmap as follows:
>>
>>       <map:match pattern="**.meta">
>>         <map:select type="resource-exists">
>>           <map:when test="resources/{page-envelope:area}/{1}.meta">
>>             <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
>>           </map:when>
>>           <map:otherwise>
>>             <!-- if there is no meta file, return a dummy file so the 
>>cinclude
>>                  for the meta data does not complain -->
>>             <map:generate src="resources/shared/dummy.meta"/>
>><!--
>>             <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
>>-->
>>           </map:otherwise>
>>         </map:select>
>>         <map:serialize type="xml"/>
>>       </map:match>
>>
>>
>>Regards
>>
>>Felix
>>
>>
>>>thanks
>>>simon
> 
> 
> what i don't understand is the different behavior of the default
> publication. there is no error at all even without the workaround
> described above.
> i'm not shure but i think it would be better there is no error and NO
> dummy.meta. i think it does'nt make much sense this dummy.meta because
> there is no relevant information in it. it would'nt make any difference
> without this information.

You have to assure that cinclude:include is never called for a
non-existing resource (maybe resource-exists selector works).
The other possibility is to guarantee that for every resource file a
corresponding .meta file exists (basically, that should always hold).

- Felix

> so i would prefer lenya just don't throw this error if there is no
> *.meta. like it is in the default publication. 
> 
> cheers
> simon
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by simon litwan <si...@wyona.com>.
> > if there is the meta file missing for an asset, i get a
> > ResourceNotFoundException. i thought i could find the problem in the
> > file includeAssetMetaData.xsl. but there is ignoreErrors set to true
> > where i think the metadata gets included. 
> > does somebody know why it still throws an error? 
> > are there other files involved in this?
> 
> <cinclude:include .../> does not support that directive,
> <cinclude:includexml .../> does.
> 
> A solution would be to create a general meta data file dummy.meta in
> resources/shared and change the code in doctypes.xmap as follows:
> 
>        <map:match pattern="**.meta">
>          <map:select type="resource-exists">
>            <map:when test="resources/{page-envelope:area}/{1}.meta">
>              <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
>            </map:when>
>            <map:otherwise>
>              <!-- if there is no meta file, return a dummy file so the 
> cinclude
>                   for the meta data does not complain -->
>              <map:generate src="resources/shared/dummy.meta"/>
> <!--
>              <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
> -->
>            </map:otherwise>
>          </map:select>
>          <map:serialize type="xml"/>
>        </map:match>
> 
> 
> Regards
> 
> Felix
> 
> > 
> > thanks
> > simon

what i don't understand is the different behavior of the default
publication. there is no error at all even without the workaround
described above.
i'm not shure but i think it would be better there is no error and NO
dummy.meta. i think it does'nt make much sense this dummy.meta because
there is no relevant information in it. it would'nt make any difference
without this information. 
so i would prefer lenya just don't throw this error if there is no
*.meta. like it is in the default publication. 

cheers
simon



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Michael Wechner <mi...@wyona.com>.
Felix Röthenbacher wrote:

>
>             <!-- if there is no meta file, return a dummy file so the 
> cinclude
>                  for the meta data does not complain -->
>             <map:generate src="resources/shared/dummy.meta"/>


it might make sense to generate an XML which is noting that no meta 
actually exists,
which then allows to treat this nicely within the XSLT.

Michi


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: ResourceNotFoundException if missing

Posted by Felix Röthenbacher <fe...@wyona.com>.
simon litwan wrote:
> hello 
> 
> if there is the meta file missing for an asset, i get a
> ResourceNotFoundException. i thought i could find the problem in the
> file includeAssetMetaData.xsl. but there is ignoreErrors set to true
> where i think the metadata gets included. 
> does somebody know why it still throws an error? 
> are there other files involved in this?

<cinclude:include .../> does not support that directive,
<cinclude:includexml .../> does.

A solution would be to create a general meta data file dummy.meta in
resources/shared and change the code in doctypes.xmap as follows:

       <map:match pattern="**.meta">
         <map:select type="resource-exists">
           <map:when test="resources/{page-envelope:area}/{1}.meta">
             <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
           </map:when>
           <map:otherwise>
             <!-- if there is no meta file, return a dummy file so the 
cinclude
                  for the meta data does not complain -->
             <map:generate src="resources/shared/dummy.meta"/>
<!--
             <map:generate src="resources/{page-envelope:area}/{1}.meta"/>
-->
           </map:otherwise>
         </map:select>
         <map:serialize type="xml"/>
       </map:match>


Regards

Felix

> 
> thanks
> simon
> 

-- 
Felix Röthenbacher                  felix.roethenbacher@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org