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

RestEasy default content marshalling returns 500 instead of 400 on bad requests

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.RC2
    • 1.0.2.GA
    • jaxrs
    • None

      We use RestEasy 1.0.2.GA on JBoss 4.3.0.GA_CP02. We have a RESTful WS that takes XML as input in the POST request body. We use the RestEasy default content marshalling to unmarshall the incoming XML into JAXB annotated Java classes. Things work fine if only valid xml is sent in to the service. However, when the XML in the http request is malformed (or invalid), RestEasy throws a WebApplicationException and returns 500 to the client. Since the input is invalid (malformed XML), the client should get 400 (bad request) instead of 500 (internal server error).

      I think the only way to bypass the above problem is to unmarshall and marshall the XMLs manually (using JAXB).

      Original post: http://sourceforge.net/mailarchive/forum.php?thread_name=49D3E1E1.9010504%40redhat.com&forum_name=resteasy-developers

              patriot1burke@gmail.com Bill Burke (Inactive)
              yi_zhang Yi Zhang (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: