How to get portal.getSiteConfig() in JAVA?

Enonic version: 6.0.0
OS: Ubuntu


I need to get the site config for my JAVA backend code to use as properties. How do I do this without passing the values in from JavaScript ?

Hmm… could you be more presise here? An example?

In JS we can do the following in a controller to get the config

var portal = require('/lib/xp/portal');
var siteConfig = portal.getSiteConfig();

How do I do that in plain JAVA ?

First of all - you would need some point where java is executed. Since we’re talking site config here, the most common scenario would be invoking java from js. In 6.1+ this could also happen in filters.

If you want config added to java, why not simply create a config file for your app?