wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serafin Sedano <serafin.sed...@abiquo.com>
Subject Re: custom exception mappers and core exceptions/errors
Date Wed, 23 May 2012 13:20:30 GMT
Hi,

We've done something similar.

We extended RequestProcessor and DeploymentConfiguration. Then in the
constructor ExtendedRequestProcessor we set our
ExtendedDeploymentConfiguration.

What did the trick for us was to extend the ResourceRegistry and add it in
the ExtendedDeploymentConfiguration. This ExtendedResourceRegistry has
the findMethod and findSubResourceMethod custom implementation that allows
the throw of our own Exception.

Regards.

Serafín.

2012/5/23 Anton Piatek1 <anton.piatek@uk.ibm.com>

> 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.
>
> Anton
>
>
>  ------------------------------
>
> *
> *
>
> *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
> *
>
>
>
>
>
>
>


-- 
Serafín Sedano | Software Engineer | Abiquo |  | serafin.sedano@abiquo.com

Mime
View raw message