nablex
nablex

Reputation: 4757

How to add static resources to vaadin

I am running a vaadin application and have some css files that reference images using "url()" syntax.

The images however are not available and on the server side you get the error:

rejecting published file request for file that has not been published

I have tried putting them nearly everywhere (WEB-INF, WEB-INF/classes, VAADIN, VAADIN/themes/.., etc) but they remain unaccessible.

How can I add static images to my vaadin application so they can be accessed by css?

UPDATE

Note that the images need to be accessible by css in the form of:

.myCssClass {
    background: url(path/to/image.png);
}

Upvotes: 1

Views: 3145

Answers (1)

win_wave
win_wave

Reputation: 1508

You should put them to VAADIN/themes/mytheme/images/ and set the theme name to mytheme. They way how you set theme depends on your Vaadin version.
Resources will be accessible like that:

new ThemeResource("images/my_image.png");

Upvotes: 2

Related Questions