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

HEAD request fails with 406 instead of resolving MessageBodyWriter

XMLWordPrintable

    • Undefined

      See the mailing list post: https://lists.jboss.org/archives/list/resteasy@lists.jboss.org/thread/IMHYPHQFSB74ZIXTCVBGHKA3TYS7WE6N/

      The problem I have, is that when a HEAD request is made, which doesn't have an Accept header, Resteasy can't figure out how to encode the result object from my resource method. Previously, Resteasy tried to find a MessageBodyWriter, which it now does not anymore, as it instead throws a NotAcceptableException. As per the comment in the code, this seems to be due to JAX-RS 2.0 section 3.8.6.

      It seems that the MessageBodyWriter resolving only occurs when there is an Accept header, which is ok if section 3.8.4 were properly respected. It states that "If A = {}, set A {'*/*'}", which AFAICS is exactly what is missing here. If '*/*' were added to A(note that "chosen" is set to that value in the code), the MessageBodyWriter resolving would AFAIK work correctly again for my case.

              rhn-support-asoldano Alessio Soldano
              christian.beikov Christian Beikov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: