resolveResource Image Vaadin 10

Hello,
when I start an application locally with jetty I see the image correctly. If I create the production package and I deploy it in tomcat, I do not see the image.
The difference is that jetty start on localhost:8080 and tomcat start on localhost:8080/warname then if I inspect the html source the generated url /frontend-es6/img/table-logo.png and not warname/frontend-es6/img/table-logo.png

I used this code:
String resolvedImage = VaadinServletService.getCurrent().resolveResource(“frontend/img/table-logo.png”,VaadinSession.getCurrent().getBrowser());
Image image = new Image(resolvedImage, “”);

How can I solve it?
Thank you,
Fabrizio

Hi Fabrizio. You need to use frontend:// instead of the frontend/ in the file path.

This is because when you create a production build, the resources are transpiled and split into two folders, es-5 and es-6 and then the framework maps all frontend:// urls to correct folder based on what does the browser support.

Hi Pekka,
sorry but i wrong to write.
With :
.resolveResource(“frontend/img/table-logo.png”,VaadinSession.getCurrent().getBrowser());
it works on Jetty (localhost) and on Tomcat 9

instead with
.resolveResource(“frontend://img/table-logo.png”,VaadinSession.getCurrent().getBrowser());
it works on Jetty localhost:8080 but it doesn’t work on Tomcat with localhost:8080/appname/

Pekka Hyvönen:
Hi Fabrizio. You need to use frontend:// instead of the frontend/ in the file path.

I would like to recommend that instruction gets more emphasis in the documentation (in the main Flow documentation, but also here: https://vaadin.com/components/image) and is incorporated in the starter examples.