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 <bbu...@redhat.com>

> 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
> > Resteasy-users@lists.sourceforge.net
> > 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
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to