ResponseReader is a custom MessageBodyReader<Response> handler which is registered on the client side, it allows to do a safe type casting, such as
Response response = webClient.get(); Book book = (Book)Response.getEntity(); It's possibe to write your own custom Response reader with any CXF version supporting the client api, but using the ResponseReader makes it simpler... Please check the demo Glen linked to. Sergey On Fri, Jan 21, 2011 at 4:08 AM, Glen Mazza <[email protected]> wrote: > I think ResponseReader, recently introduced in CXF 2.3.1, is your friend. > > If you go to the Talend Service Factory (CXF wrap) Examples[1], under > examples/jaxrs-advanced/client/..../RESTClient.java, method useSimpleProxy() > has it. > > Glen > > [1] http://www.talend.com/resources/documentation.php#SF > > > On 20.01.2011 22:11, Dan King wrote: > >> Hi all, >> >> Up until now I've had the web client return the desired java object rather >> then >> a Response object, i.e. Object target = >> >> client.type("application/json").accept("application/json").get(Target.class) >> >> But now I want to check the response and then get the entity/message body, >> but >> I'm stuck on how to convert the response input stream -- >> Response.getEntity() -- >> into the desired java object. >> >> I'm using all default settings, all the DTO classes use jaxb annotations >> (@XmlRootElement), and the message body is in json format. Does anyone >> know how >> to do the conversion/unmarshalling? Can anyone point me to some examples? >> >> >> Thanks. >> >> -Dan >> >> >> >> >> > > -- > Glen Mazza > Software Engineer, Talend (http://www.talend.com) > blog: http://www.jroller.com/gmazza > > >
