I am trying to use a custom exception mapper to format all exceptions into my desired xml/json types depending on the content type.

I am handling my own exceptions happily and returning the http status code I want, and the right xml/json response with the right helper messages, but when it comes trying to catch wink errors such as a url/method/body being wrong and not matching a handler I am struggling. I want to handle these myself because wink does not format them into xml/json, and if it did, would still be choosing its own format rather than mine.

I have an exceptionMapper which handles WebApplicationException but from the exception I get there, I cannot figure out how to get a description of the cause. I can get the stack, which normally isn't helpful, and I can get the http status code from the response, but trying to get a string saying "there is no handler for method PUT on resource /wibble/" seems to be impossible.

Has anyone attempted this? Did you find a solution?

The closest I can get is parsing the http status code and writing a description stream for each, but then I have to parse the Request object to work out what the user called. I would have thought wink has already done some of this for me.


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU