|
From: Rodrigo U. <rod...@gm...> - 2014-04-28 19:52:45
|
Hi everyone! Is there a way, using the client API, to map HTTP response codes to Exceptions? I'm developing clients that make calls to REST endpoins. These endpoins return multiple response error codes. To make things easier on the client side, I would like to map these response codes to some of my custom client Exceptions. For instance, a response code 409 could map to a BusinessException and so on. To achieve this, my first instinct was to use a ClientResponseFilter. It even worked, but the JAX-RS runtime is wrapping my exceptions inside a *javax.ws.client.ResponseProcessingException*. Although that does not stop me, all these "arrangements" are making me wonder if I chose the right path. Summing up, is using a ClientReponseFilter the best way? |