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

Adjust the ServiceBuilder-generated Clp classes to support non-ServiceBuilder classes in the service APIs

    Details

      Description

      If you have non-ServiceBuilder generated classes in your Service API, the generated Clp classes will be unaware of those classes and you'll run into ClassCastExceptions if you try to access the service from another portlet. A workaround is to put those custom classes in an ext plugin under ext-service but a superior solution would be to modify the Clp mechanism to allow injection of custom serializers.

      The important code is in ClpSerializer.translateOutput. If an API class is not a ServiceBuilder class (subclass of BaseModel) or a List, the translation returns the original class which is what offends the calling portlet's classloader.
      [quote] public static Object translateOutput(Object obj) {
      if (obj instanceof BaseModel<?>)

      { return translateOutput((BaseModel<?>)obj); }

      else if (obj instanceof List<?>)

      { return translateOutput((List<Object>)obj); }

      else

      { return obj; }

      }
      [/quote]

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              nathan.shaw Nathan Shaw (Inactive)
            • Votes:
              18 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package