You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Chris Eineke (JIRA)" <ji...@apache.org> on 2013/08/26 20:23:52 UTC

[jira] [Created] (CXF-5235) Cannot use multiple ResponseReaderS

Chris Eineke created CXF-5235:
---------------------------------

             Summary: Cannot use multiple ResponseReaderS
                 Key: CXF-5235
                 URL: https://issues.apache.org/jira/browse/CXF-5235
             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: http://www.atlassian.com/software/jira