Using Resteasy 3.0.4 Final, I can not get the Entity on "void" methods.

I have a @DELETE method returning "void" normally (status 200) but an
serialized Error on status 400.
Using the following catch is working if method is normally returning an
Entity :
        } catch (BadRequestException e) {
            Response resp = e.getResponse();
            err = resp.readEntity(Error.class);
        }

On delete I have a "Response is closed" error.
Debugging a little, I found that the DefaultEntityExtractorFactory reads
the Entity :
            if (status >= 400)
            {
               response.bufferEntity();
               response.close();
               ClientInvocation.handleErrorStatus(response);
            }

So the response is closed but available in the bufferedEntity field.
But the ClientResponse.readEntity is checking :
   public <T> T readEntity(Class<T> type, Type genericType, Annotation[]
anns)
   {
      abortIfClosed();
      ...

The response is closed but the entity has been buffered, so error entity
can not be got.

Is it the expected behavior ? Is there a way to get the buffered entity ?
By extending the DefaultEntityExtractorFactory ?

Thanks.




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
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&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