Reputation: 1817
I am using liferay.
I need to get some variable from portal-ext.properties in liferay-portal.xml file. How can I get those values? Can I made some my custom java class form where I can get value of some parameter there?
Upvotes: 0
Views: 1391
Reputation: 48067
First, there is no mechanism to achieve exactly what you ask for (none that I know of at least).
For the underlying problem that you state in your comment, you might want to check how many CSS files are actually downloaded from your portal: Typically Liferay minifies JS and CSS files and delivers them from cache, with proper caching headers - and it delivers only one file of each, combining all the referenced files (correct me if that's wrong - careful, don't look at developer mode where the minifier is explicitly turned off)
If you deliver all individual portlet's header files from CDN you might end up with 10 individual requests to CDN which might end up slower than a single minified request/response to your own portal.
My advice would be to first measure performance manually (e.g. measure local files, then reference CDN location manually and measure again).
There might be something in Liferay's API that you can override during the initialization phase, when you can programatically read the configured values, but I haven't checked this yet. Also, please make sure that the minifier doesn't go out to the CDN to fetch the resources in order to minify them and deliver them from the portal. This would be counterproductive and just add complexity to your system.
And lastly, for your specific system, you could also just "always include" the CDN resources on every page (add them to your theme) and have your portlets assume that they are included. This works well if you have only plugins that you develop yourself, not if you develop plugins for others.
Upvotes: 3