From: Jean-François H. <jfh...@gm...> - 2013-08-28 06:35:26
|
In this case with RestEASY 2 you may also use : try { proxyClient.somethingThatReturnsError500(); } catch (ClientResponseFailure ex) { LOGGER.info( "Got a ClientResponse exception with status [{}]", Integer.toString(ex.getResponse().getResponseStatus().getStatusCode())); ErrorObject err = (ErrorObject) ex.getResponse().getEntity(ErrorObject.class); } 2013/8/20 Bill Burke <bb...@re...> > Use REsteasy 3 and the new JAX-RS 2.0 client api. Then you just return > a Response, check the status, and extract whatever you want. > > On 8/20/2013 11:42 AM, Jason Novotny wrote: > > Hi, > > > > Typically I have resteasy calls like: > > > > @POST > > @Path("/blah/restcall") > > ClientResponse<MyObject> restCall(); > > > > Where I expect to get MyObject back-- however, the third-party API I'm > > using will flag the response code as 500 if it turns out to be an error, > > in which case MyObject should really be ErrorObject. Is there a way to > > handle this case easily? > > > > Thanks, Jason > > > > > ------------------------------------------------------------------------------ > > Introducing Performance Central, a new site from SourceForge and > > AppDynamics. Performance Central is your source for news, insights, > > analysis and resources for efficient Application Performance Management. > > Visit us today! > > > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > > _______________________________________________ > > Resteasy-users mailing list > > Res...@li... > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com > > > ------------------------------------------------------------------------------ > Introducing Performance Central, a new site from SourceForge and > AppDynamics. Performance Central is your source for news, insights, > analysis and resources for efficient Application Performance Management. > Visit us today! > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > |