You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/02/01 17:32:43 UTC
Proposal: Cocoon 2 and HTTP Error Handling
This proposal stems from the irony of mapping Cocoon 2
to match "/" in the servlet engine. With Cocoon 1, if
a source XML document could not be found, you got a
classic 404 Document Not Found Error. WIth Cocoon 2,
you get a much more essoteric 500 error--which in 9
out of 10 cases is not the desired functionality.
My proposal is to throw a 404 Error if a Generator
or a Reader can't find the requested resource. Why
at the Generator stage? Because that is the only
location in the pipeline that really makes sense,
and where the absence of a template does not constitute
an error.
For example:
<!-- Sample Pipeline -->
<map:match pattern="**.html">
<map:generate src="docs/{1}.xml"/>
<map:transform src="stylesheets/document2html.xsl"/>
<map:serialize/>
</map:match>
<map:match pattern="**.gif">
<map:read src="images/{1}.gif" mime-type="image/gif"/>
</map:match>
Using the request "sample/foo.html", I would retrieve
"docs/sample/foo.xml". If that document doesn't exist,
it is a 404 Error. If the stylesheet didn't exist, then
that is a more serious error worthy of a 500 type error.
If the "sample/foo.html" document used "sample.gif", and
no "images/sample.gif" file existed--then that is a 404
error.
Also, if there is a request that does not match anything
in the sitemap, we should generate a 404 error.
That way, everything functions to the end user like they
expect it to.
Re: Proposal: Cocoon 2 and HTTP Error Handling
Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 1 Feb 2001, Berin Loritsch wrote:
> This proposal stems from the irony of mapping Cocoon 2
> to match "/" in the servlet engine. With Cocoon 1, if
> a source XML document could not be found, you got a
> classic 404 Document Not Found Error. WIth Cocoon 2,
> you get a much more essoteric 500 error--which in 9
> out of 10 cases is not the desired functionality.
>
> My proposal is to throw a 404 Error if a Generator
> or a Reader can't find the requested resource. Why
> at the Generator stage? Because that is the only
> location in the pipeline that really makes sense,
> and where the absence of a template does not constitute
> an error.
+1 for using HTTP error codes the way they were intended to be used.
- donald