Datasource portal:createResourceUrl not in java.el

Enonic version: 4.7.11
OS: Linux

This works:

<datasource name="getUrlAsXml" result-element="morradi"> <parameter name="url">http://localhost:8080/site/59/_public/file.xml</parameter> <parameter name="timeout">5000</parameter> <parameter name="readTimeout">3000</parameter> </datasource>

This does not:

<datasource name="getUrlAsXml" result-element="morradi"> <parameter name="url">${portal:createResourceUrl('/_public/file.xml')}</parameter> <parameter name="timeout">5000</parameter> <parameter name="readTimeout">3000</parameter> </datasource>

If you in Enonic Datasource Java.el want to synthesize URLs based on a environment-specific server address, my advice would be to store the server base URL inside cms.properties or site-X.properties, and then retrieve this value using Java.el ‚Äúproperties.myPropertyName‚ÄĚ concatenated with the string for the file address.

See the 4.7 docs on Java.el in datasources ‚Äď properties (new in 4.7.4)

1 Like