cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Commented] (CXF-5235) Cannot use multiple ResponseReaderS
Date Tue, 27 Aug 2013 09:09:51 GMT


Sergey Beryozkin commented on CXF-5235:

Well, the problem is, if you have multiple methods returning Response, on the client side
we do not know what kind of typed payload that Response may represent, this knowledge can
only be encoded at the point of retrieving the actual data. Using ResponseReader to deal with
multiple Responses is possible but only using the pattern documented at

Note, starting from CXF 2.7.x, 2.0 API has Response.readEntity(Class) method, the idea is
basically the same, the type info is provided at the point of getting the data

> Cannot use multiple ResponseReaderS
> -----------------------------------
>                 Key: CXF-5235
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.6.8
>            Reporter: Chris Eineke
>            Priority: Critical
> I've created a factory that uses JAXRSClientFactory to create implementations of my service
interface classes.
> In the body of each method I create a list of providers to be used by JAXRSClientFactory.create,
some of them being ResponseReaderS. Here's an example:
>         JAXBElementProvider jaxbProvider = new JAXBElementProvider();
>         JSONProvider jsonProvider = new JSONProvider();
>         jsonProvider.setDropRootElement(true);
>         jsonProvider.setSupportUnwrapped(true);
>         jsonProvider.setConsumeMediaTypes(Service.ContentTypeSummary.PRODUCE_MEDIA_TYPES);
>         jsonProvider.setProduceMediaTypes(Service.ContentTypeSummary.CONSUME_MEDIA_TYPES);
>         List<Object> providers = Lists.newArrayList();
>         providers.add(jaxbProvider);
>         providers.add(jsonProvider);
>         providers.add(new ResponseReader(MyListV1.class));
>         providers.add(new ResponseReader(MyV1.class));
>         providers.add(new LoggingOutInterceptor(new PrintWriter(System.out)));
>         providers.add(new LoggingInInterceptor(new PrintWriter(System.out)));
>         return JAXRSClientFactory.create(
>             System.getProperty("service.url"),
>             MyRestfulService.class,
>             providers,
>             true);
> This particular service has two methods: one that returns a list of MyV1 and another
one that just returns a MyV1. Now, it seems that the web client under hood always uses the
first registered ResponseReader for any sort of response. If I call getMyV1 with the above
order, I get a CCE. It works fine when I call getMyListV1, though. If I switch the order around,
the service calls work vice versa as well.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message