users@jersey.java.net

Re: [Jersey] User defined exceptions

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Fri, 17 Jul 2009 13:22:23 -0700

2009/7/17 António Mota <amsmota_at_gmail.com>:
> So what you're saying is that the use by Microsoft of substatus doesn't
> conform to the specification because it uses part of the reason-phrase to
> send the sub-code? Gee, I never that Microsoft could do such thing...
>
> Ok, so instead of using
>
> 500.1 - Not on Fridays
> 500.2 - Give me a break
>
> you could use
>
> 511 - Not on Fridays
> 512 - Give me a break
>
> That way you're using a extension-code that is conform with the
> specification, your own clients understand it, and all other clients will
> interpret then as 500.
...

I agree in that it makes sense to:

(a) Use HTTP response code as coarse definition of what the problem is
(client vs server; some sub-categories), using closest match and
(b) Add clarifying information that client understands, given context
of this service (it knows which service it called, and thereby
request/response information and its structure -- or at least how to
derive those things)

but I don't think trying to reuse an HTTP header (that does not have
such sub-code semantics) would be better than actually defining
regular response structure client could understand.
And I specifically think it is a bad idea to start redefining actual
codes -- in future, 511 for example may well be defined to mean
something by w3c.

So I would just return a response structure that has whatever
definition are needed for more granular indication of the problem, and
pertinent request information to help in troubleshooting.

-+ Tatu +-