What directory do images go in so that they display?

This was a little better documented in CUBA I think - what directory do images need to go in, in order to display?

I have in my login screen,

                    <image id="logoImage" scaleMode="SCALE_DOWN" stylename="jmix-login-icon" align="MIDDLE_LEFT">
                            <relativePath path="m.png"/>

But the image shows a blank. If I change relativePath to file I get an exception.

I have it in the main resources directory but that seems to not be correct. Better documentation of the file system and where things need to go would be super helpful…


The relative path resource is a resource that is stored in the directory of deployed application. if you check the generated url for a relative path, you’ll see something like this:

<img ... src="http://localhost:8080/test.jpg">

Obviously, every file placed in the resources directory cannot be accessed via a URL due to security measures. To get access to a file using the relative path resource approach, you need to create a VAADIN folder in the root of the resource directory, because files stored in this directory is accessible via URL, e.g.:

Screenshot 2022-01-26 at 11.02.09

Resource definition:

<relativePath path="VAADIN/test.jpg"/>

Generated url:

<img ... src="http://localhost:8080/VAADIN/test.jpg">

Alternatively, you can use the class path resource:

<classpath path="m.png"/>

I’ve created a GitHub issue in order to extend the relative path resource description.