You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alexis Georges <ve...@gmail.com> on 2009/05/22 14:31:57 UTC

Avoiding non-existent URIs

Hello everyone,

I have been using Cocoon with XSLT (2.0) and eXist for a simple blog.

I have some simple matchers as follows:

"news/*/" => "news/2009/"
"news/*/*/" => "news/2009/05/"
"news/*/*/*/ => "news/2009/05/22/"

I then have a resource which loads a template into the pipeline, and  
applies a stylesheet. This stylesheet calls document() on an Atom feed  
document stored in eXist, and filters the feed to contain only the  
valid entries for the given wildcards (date, month, day).

One thing I had not realized was that there is a big problem with this:

"news/1234/" will work fine, but obviously something is wrong: I  
should return a 404 (or at least not a 200).

But with the current (simple) setup, how could I do that?

In the XSLT I can obviously know that there were no matching entries,  
hence a call to error() would return control to Cocoon which could  
handle the "Internal Server Error", and in that pipeline context, such  
an error would be understand to mean that the resource was not found,  
hence a 404.

Do you have any hints or suggestions? Is this a reasonable way of  
ruling out invalid URI?

Thanks

Alexis Georges

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