Closed wsyski closed 5 years ago
Hi @wsyski, it would not be possible to add the service in a pure JS project, which is the goal of this toolkit.
However, I guess that if the configuration API supports it, you should be able to deploy the service through a different module and then simply link the service using the API. I don't know if that's supported by default though, as we're simply using existing infrastructure in DXP.
@brunobasto, do you have any insight into how to achieve this?
Hum.. As far as I know, if you deploy any other module containing a ConfigurationAction
with a javax.portlet.name
pointing to the portlet you want, which is basically what @jbalsas pointed out, it should work. So, you might have:
javax.portlet.name=awesome
)javax.portlet.name=awesome
)@Component(
immediate = true,
property = "javax.portlet.name=awesome",
service = ConfigurationAction.class
)
public class AwesomeConfigurationAction extends DefaultConfigurationAction {
}
I have not tested it, but it could work.
This seems to be a very elegant solution. I am going to test it. Thanks
I have tried to write an angular portlet with portlet configuration as a separate project: https://github.com/wsyski/angular-portlet.git I got it almost working, but the problem is that in the configuration project liferay can not find the configuration.jsp page. Everything works fine when I move configuration.jsp to the portlet project. Could you please have a look in my project and tell me what I am doing wrong? How to tell Liferay that configuration.jsp is in the configuration project, not in the portlet project? The portlet works fine but when I try to run Portlet Configuration get an error: 2019-07-13 20:21:05.452 ERROR [http-nio-6080-exec-1][PortletConfigurationPortlet:688] /configuration.jsp
Hum. That might be a bug/limitation. Probably somewhere in portal we assume that the configuration.jsp
lives in the same bundle as the Portlet class as try to forward to that module's path.. I'd say this is a bug..
Any suggestions? I would be very happy to work with pure npm environment after separating the configuration project. I see one more obstacle. I would need to be able to define portlet configuration in the test only mode to be able to run the portlet without liferay. Are you going to provide this feature?
I would say you are hitting a limitation of the Portal. However, it is possible that you can do what you are trying to achieve with OSGi fragments.
In theory you can create an OSGi fragment bundle that deploys the action and the JSP and attaches to the pure JS portlet bundle.
An OSGi fragment is basically and amendment of an existing bundle packaged as a JAR. When OSGi sees a fragment, it merges the contents of the JAR into the fragment's target bundle and it looks as if the two JARs where just one.
Said that, I have never developed a fragment, so I cannot guarantee that the approach will work for the JSP because it depends very much on the internals of the portal and OSGi. But I would say it is worth giving it a try.
I'm closing this. Feel free to reopen it if needed. Thx :-)
I have got it working with osgi fragments. Thanks for the hint.
This is a question. Sometimes it is not possible to provide configuration.json ex. when values of configuration keys need to be provided by the service (ex. user needs to select a collection of tags and the list of possible values is provided by the service). I wonder if it is possible to use Liferay Js Portlet Extender with a custom ConfigurationAction written in java. Do you have an example code for this?