Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3780

Make json plugin more extendable

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1.2
    • Fix Version/s: 2.3.3
    • Component/s: Plugin - JSON
    • Labels:
      None
    • Flags:
      Patch

      Description

      Currently it is difficult to modify/extend the current behaviour of the json plugin.
      I had the following problem. We use joda-time because it is much better than standard Date. The json plugin cannot handle classes like LocalDate, which is not a problem in itself. But it needs a lot of boilerplate code to output beans containing a LocalDate field using json. Currently I have to create duplicates of the service layer DTO-s, annotate the fields in the UI copy with @JSONFieldBridge, and copy one DTO into the other using dozer or something.
      This creates a lot of useless code and manual work. It would be much easier if I could extend JSONWriter and add support for my joda-time classes. No duplication of DTO-s, no need to manually annotate all fields. This would require only to modify the visibility of some private methods to protected, and some package-protected classes to public. This way I could create my struts2 result type, which extends JSONResult, and use my writer, which extends JSONWriter.

        Attachments

        1. WW-3780.diff
          12 kB
          Pelladi Gabor

          Activity

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              pelladi Pelladi Gabor
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: