cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Proposal: Cocoon 2 and HTTP Error Handling
Date Thu, 01 Feb 2001 16:32:43 GMT
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.

Mime
View raw message