Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWA does not find files from the spring static resources directory #4687

Closed
SomeoneToIgnore opened this issue Oct 10, 2018 · 8 comments
Closed

Comments

@SomeoneToIgnore
Copy link
Contributor

Based on vaadin/bakery-app-starter-flow-spring#664 (review)

Take https://github.com/vaadin/skeleton-starter-flow-spring
Note that the icon file is located in the src/main/webapp/icons directory.
Also note that if you launch the app, the icon is available as a static resource at http://localhost:8080/icons/icon.png

Move the icon to src/main/resources/static/icons directory, restart an app.

Expected: the icon is still shown and loaded
Actual: the default icon is loaded (and the icon is still available at http://localhost:8080/icons/icon.png)

It seems like PWA resources loader should support the resources placed in the standard Spring directories.

@pleku
Copy link
Contributor

pleku commented Oct 31, 2018

After this one is fixed, we should change the location of these files in Bakery & Project Base for Spring too.

@denis-anisimov denis-anisimov self-assigned this Nov 2, 2018
@denis-anisimov
Copy link
Contributor

I'm not sure whether I correctly understand the issue because it seems I can't reproduce it.
If I move �icon.png into the �src/main/resources/static/icons then URL �http://localhost:8080/icons/icon.png still works for me as it should.

If this is the only issue then there is nothing to fix except the example projects.
If it's not the issue then I doin't understand what should I check to see that something is wrong.

The standard directory for Jar is �src/main/resources/META-INF/resources. And this directory works for me as well.

So I will just move icon file (and any other resources) from webapp to this directory for all sample projects and that's it.

Please let me know if there is a real issue in Flow which I don't see at the moment related to PWA and Spring (as I understand we don't have any code which reads the specific directories. The code relies on the static web resources availability. So it's just about whether one or another location works as a static resources location. And it doesn't relate to PWA anyhow. )

@denis-anisimov
Copy link
Contributor

Bakery already has the icon in the static folder as requested.
So nothing to do for it.

@pleku
Copy link
Contributor

pleku commented Nov 5, 2018

You should verify that the icon works also - so that Flow is able to generate the resources based on the icon (there are different sized icons for different devices generated).

for (PwaIcon icon : getIconTemplates(pwaConfiguration.getIconPath())) {

Also now realized, that the besided the icons, also the offline page should work from the static file location for Spring https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/pwa/tutorial-pwa-offline.asciidoc

@denis-anisimov
Copy link
Contributor

I've verified that icons are generated for the icon within path META-INF/resources.
Also offline.html file inside this location works.

So I close this.

@denis-anisimov denis-anisimov added this to the Abandoned milestone Dec 17, 2018
@cedricaebi
Copy link

Still doesn't work. I use Spring and packaging jar. My icon is in resources/META-INF/resources/icons/icon.png
offline.html is in resources/META-INF/resources/offline.html

Locally everything works. The icon gets fetched and converted into 144x144 etc. But when i deploy it to the server, vaadin overwrites it with the default icon without an error message. offline.html gets fetched correctly.

@ajgassner
Copy link
Contributor

ajgassner commented Aug 30, 2019

@cedricaebi I can confirm. It does work locally but not when running as jar.
@denis-anisimov Please reopen the issue and assign it to the correct project, maybe vaadin-spring?

Regardless if this issue is related to flow, vaadin-spring or any other project it should be fixed. Most people I guess use Vaadin in conjunction with Spring Boot these days.

I've found a very dirty classpath hack to workaround the issue 🙄
You can overwrite Vaadin's default logo with your icon, see screenshot.

image

@pleku pleku reopened this Sep 2, 2019
@pleku pleku removed this from the Abandoned milestone Sep 2, 2019
@pleku pleku added this to Needs triage in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) via automation Sep 2, 2019
@mehdi-vaadin mehdi-vaadin moved this from Needs triage to P2 - Medium Priority in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Sep 13, 2019
@jm-ferreira jm-ferreira moved this from P2 - Medium Priority to New P2 in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Feb 27, 2020
@denis-anisimov
Copy link
Contributor

The ticket is apparently about running the app via jar even though the original description doesn't say that:

@cedricaebi I can confirm. It does work locally but not when running as jar.

We have another ticket for that with a proper description which is fixed.

OLD Vaadin Flow bugs & maintenance (Vaadin 10+) automation moved this from New P2 to Closed Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants