Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-33416

Improve internal conversions of jsonws invoker




      Currently, _convertObjectToMap method in JSONWebServiceInvokerAction does the following: serialize object and then deserialize it to a map. This is not so fast. There might be two better solutions:

      1. Add TypeAwareMap or TypeWrapperMap that wraps an object ie bean, and handle keys as bean properties
      2. Or simply copy all bean properties to a map, manually, on creation.

      The first solution seems fine on the first sight, as it require less reflection usage (just for the properties that are needed). However, deserialization would fetch all map keys, i.e. all bean properties, so therefore I am leaning towards the second approach.

      Just be careful to skip the excludes, as this is currently done automatically!!!

      One more caveat: due to current serialization, all properties will be serialized as well - therefore, an int[] property will be serialized to List. This would change with this LPS; should not have any negative impacts.


      The same thing applies to conversion of an object to a list (method _convertObjectToList. Currently, we do serialize an object and then deserialize it to list. This is expensive. Direct conversion is better solution.

      Moverover, currently we support only List types. This story will expand support to arrays and collections in general; allowing service to return e.g. an array or hashset and still being able to filter it.




            • Assignee:
              david.truong David Truong
              igor.spasic Igor Spasic (Inactive)
              Recent user:
              Shalaka Tendulkar
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:


                Version Package
                6.2.0 CE M5