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

Default Jettison JSONProvider: @ for element attributes in JSON

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Won't Fix
    • 2.3.4
    • 2.4.1, 2.3.5
    • JAX-RS
    • None
    • Unknown

    Description

      Initial description:
      Jettison provides a configuration option to omit the '@' from attributes:
      org.codehaus.jettison.mapped.Configuration.setSupressAtAttributes(boolean)
      see Jettison Jira:
      http://jira.codehaus.org/browse/JETTISON-2

      org.apache.cxf.jaxrs.provider.JSONProvider should also expose this property.

      --------------------------------------------------------------------------------

      My additional comments:
      I think the original issue is not fixed.
      There is a solution by subclassing the JSONProvider like Sergey Beryozkin said

      "
      Sergey Beryozkin added a comment - 03/May/11 14:05
      What you may want to do is to register a custom JSONProvider provider which overrides its createWriter method (copy the code from the parent method and set suppressAtAttributes property on Configuration). May be it will help ?
      "

      But in reality we can't override the createWriter method just do add the simple line:
      config.setSupressAtAttributes(true); //MODIFIED

      Because the original createWriter method is using a lot of private attributes in the original class, which are not accessible in the subclass, even by a getter.

      The only solution i had was to copy the original class and add a single line.
      It is not for many reasons like: if i update my CXF lib version, i will have to report the JSONProvider updates in my copy, or keep my outdated copy.

      I think a boolean setter should be set in the org.apache.cxf.jaxrs.provider.JSONProvider so that we can tell to JSONProvider if we want to use the config.setSupressAtAttributes(true).

      Thanks

      Attachments

        Issue Links

          Activity

            People

              sergey_beryozkin Sergey Beryozkin
              sebastienlorber Sebastien Lorber
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified