How to get url for static resource

There is a static resource/image in my jar.
This image isn’t published as ennonic content.

I’m trying to use assertUrl. But no luck: "URI+out+of+scope "

Static resources are stored: APP.jar\site\assets\img\ico\
Is there any way how to get URL for this static file from JS code?

<img data-th-src="${portal.assetUrl({'_path=img/ico/icon.png'})}" />

On your project, assets are inside the path “src/main/resources/assets”?


For example, file is … \src\main\resources\site\assets\manifest.json

  1. Jar is ok:

  2. JS Service is next:

As u can see error is the same.

But, when I’m using assertUrl in HTML templates all is OK.

That’s weird. I had something like this early in about 6.3… Try to put the manifest.json inside a folder and try again in the new path.

Hmm do you also have an asset folder on resourses root? Resourses/site/assets is legacy structure - use resources/assets

The same error: content/_/error/400?message=URI+out+of+scope :frowning:

Thee same error. My version 6.5.4

This error happens when you try to generate a URL pointing outside of the current Virtual Host mapping

My guess is that you have a Virtual Host mapping pointing directly to the service. = {host}
mapping.admin.source= {external-path} = {internal-path}/_/service/{service-application}/{service-name}

You should not map directly to the service, but rather have a = {host}
mapping.admin.source= {external-path} ={internal-path}

Yeap, something like this.
I’ve checked this at ServletRequestUrlHelper and its pretty strange.
I’ve solved this via own code workaround.