Dhanji R. Prasanna schrieb:
>
> On 4/11/07, *Paul Sandoz* <Paul.Sandoz_at_sun.com
> <mailto: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.
As long as this doesn't limit us in using new status codes...
> 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...
Also, some protocols require specific response bodies on errors (see
<
http://greenbytes.de/tech/webdav/rfc3253.html#rfc.section.1.6>).
Best regards, Julian