CXF
  1. CXF
  2. CXF-5235

Cannot use multiple ResponseReaderS

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: 2.6.8
    • Fix Version/s: Invalid
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

        Activity

          People

          • Assignee:
            Sergey Beryozkin
            Reporter:
            Chris Eineke
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development