Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-483

Custom MessageBodyWriter superseded by build-in MessageBodyWriter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • 2.1.0.GA
    • 2.0.1.GA
    • None
    • None

      I have a method that produces both "text/plain" and "application/xml". Defined as:

      @GET
      @Path("/customDtos")
      @Produces(

      {"text/plain", "application/xml"}

      )
      public List<CustomDto> getCustomDtos();

      CustomDto is a JAXB annotated pojo.

      isWriteable always returns true for CollectionProvider, even though it seems it cannot cater for "text/plain". CollectionProvider then fails in writeTo when it tries to find a JAXBContextFinder for "text/plain". Since CollectionProvider's isWriteable returns true my custom MessageBodyWriter is never reached.

      Either the CollectionProvider isWriteable should have additional checks if it cannot cater for media type "text/plain" or application MessageBodyWriters should get precedence. Or am I missing something?

            patriot1burke@gmail.com Bill Burke (Inactive)
            fvnkerk Frans van Niekerk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: