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

RESTEasy + WELD + HibernateValidator - ConstraintViolations always reported as MIME "text/plain".

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.15.Final
    • 3.0.13.Final
    • CDI Integration
    • None

      I've already asked this question in the WELD forums, but it's been suggested that I ask it here too:
      []

      I am running WELD 2.3.1.Final inside Tomcat 8, along with RESTeasy 3.0.13.Final and Hibernate Validator 5.2.2.Final, and I have discovered that constraint violations from Hibernate Validator are always being reported as MIME type "text/plain". My understanding of Hibernate Validator is that the ValidationReport is supposed to be returned as JSON if the HTTP Accept request header is set to "application/json".

      Specifically, from Chapter 51. Validation

      If any constraint violations are detected, Resteasy will return a report in one of a variety of formats. If one of "application/xml" or "application/json" occur in the "Accept" request header, Resteasy will return an appropriately marshalled instance of org.jboss.resteasy.api.validation.ViolationReport

      This problem only happens when I use Resteasy + WELD + Hibernate Validator. I have attached two example projects containing the same Arquillian test, except that weld-validator also contains WELD whereas resteasy-validator contains only Resteasy + Hibernate Validator.

      Is this a bug, please? It looks like there is a problem with the WELD / Resteasy / Validator bridging.

            rsigal@redhat.com Ronald Sigal
            chrisjr_jira Chris Rankin (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: