abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Moseley" <...@osafoundation.org>
Subject Re: 404 should be... + Provider to throw exceptions ?
Date Thu, 01 Nov 2007 21:40:18 GMT
On Nov 1, 2007 2:10 PM, Neale Upstone <neale@whirlwindmatch.com> wrote:
> Mmm.. without wanting to get into a war of ideals, I'm very clear that
> 2) using a search engine, is not my idea.  Code should be self
> documenting, not require integration with Google.  I want to get on with
> writing code, not hitting search engines.

listen, i don't mean to be rude, but i don't think it's asking much to
know what the http status code means if you're going to work with an
http-based protocol. the provider abstraction is not meant to make
your applications unaware of their existence in an http environment.

with that said...

>     class AtomUtils...
>     static public void checkContentType( request ) throws
> UnsupportedMediaTypeException;
>     with Provider.java allowing a base HttpStatusException to be thrown.

i've actually used this pattern with great success in a slightly
different area. my server supports both atom and webdav, and i've
created a dav protocol handler using the same basic request
handler/provider design as abdera's. the main difference is that dav
providers throw specifically typed exceptions that are caught and
output by the request handler. it is the job of the exception class to
provide a) a status code and b) an xml document describing the error.

one of the items on my task list, forever bumped to the bottom, is
incorporating this exception handling mechanism into the abdera server

in general i agree that code should be expressive. i only take issue
with the suggestion of replacing well-known status codes with
constants that take 10 times as many characters to type, and to read,
when there's intellectual value in knowing the codes themselves.

View raw message