Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3822

JAX-RS: A 406 status could should be returned for an improperly formatted Accept header

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.6, 2.4.2
    • 2.3.7, 2.4.3, 2.5
    • JAX-RS
    • None
    • Java 1.6

    • Novice

    Description

      If you send an Accept header that doesn't contain a slash (i.e., /), CXF's JAX-RS implementation returns a HTTP status of 500 (Internal Server Error). Instead of this status, it would be preferred if a HTTP status of 406 (Not Acceptable) is returned.

      Here's the test header:

      Accept: foo

      Here's the current response:

      Status Code: 500 org.apache.cxf.interceptor.Fault: Media type separator is missing

      Here's the preferred response:

      Status Code: 406 Not Acceptable

      I've attached a potential patch against trunk for this issue:

      Attachments

        1. cxf3822.trunk.patch.diff
          2 kB
          Ka-Lok Fung

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            kfung Ka-Lok Fung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.25h
                0.25h
                Remaining:
                Remaining Estimate - 0.25h
                0.25h
                Logged:
                Time Spent - Not Specified
                Not Specified