dev@jsr311.java.net

Re: Container Independence

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Wed, 11 Apr 2007 23:23:25 +1000

On 4/11/07, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
>
> It is intended to be thrown by the application when it wants to return
> an HTTP error response, for example:
>
> throw new WebApplicationException(500);
> // an enum would be better than 500 :-)


ok that makes much more sense now. Yep, should definitely be an enum. But
let's not have subclasses for each status code, please!
I've no objection to static factories, however:

throw WAE.newNotFoundException();
throw WAE.newForbiddenException();

The application will use HttpResponse if it needs to return a
> representation as the body of the HTTP error response.
>
> Does that help explain the rational?


Ok that makes sense--it is looking a lot nicer than I first thought =)

Do you have any idea about how this will work in a servlet container?
A webapp can configure a custom error page for each type of error, how would
this work if custom content were returned? Just thinking ahead...

Dhanji.