On 20 Aug 2010, at 3:42 PM, Stephen Colebourne wrote:
> I'm building a system where there are two distinct types of output -
> web service and website.
>
> For the web service, I want exceptions to map to status codes. For the
> website, I want to map to error pages. Are there any strategies for
> doing this? The exception mappers seem to be global.
In theory, web browsers should be able to handle the status codes just
like any well behaved restful client, ideally you should have similar/
the same behaviour for both.
In the case of your website, you'd output suitable pages along with
the status codes, most probably responding to the Accept request
header (if the client says "I accept text/html", chances are the
client is a browser of some kind, and a pretty html response would
make sense).
Regards,
Graham
--