You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
View not loaded when Spring Boot static resource locations has a file system entry #17303
If the project set a filesystem location (e.g. file:web/static/) in the spring.web.resources.static-locations setting of application.properties file, the application fails to load views with a not-blank route path, when they are accessed directly by their URL (e.g. http://localhost:8080/mytest).
When accessing the page, depending on the static-locations configuration, the request ends in an error that may be a java.io.FileNotFoundException: /absolute/path/to/web/static/mytest for absolute paths or java.lang.IllegalArgumentException: URI is not hierarchical for relative paths.
The reason is that SpringVaadinServletService.getResourceURL() returns a valid URL also for non-existing resources.
In the above link example, the URL is file:web/static/mytest.
Classpath locations work, because when Resource.getUrl() is invoked they throw an IOException that is handled by SpringVaadinServletService
Expected behavior
StaticFileServer should ignore not-existing resources, allowing the view to be shown correctly
Minimal reproducible example
Create a new Vaadin project npx @vaadin/cli init my-app
Edit application.properties and add spring.web.resources.static-locations=file:web/static (it doesn't matter if the location exists or not)
Activity
fix: handle spring boot relative path for static resource
fix: handle spring boot relative path for static resource
fix: handle spring boot relative path for static resource (#17305)
fix: handle spring boot relative path for static resource (#17305)
fix: handle spring boot relative path for static resource (#17305)
fix: handle spring boot relative path for static resource (#17305)
fix: handle spring boot relative path for static resource (#17305) (#…
fix: handle spring boot relative path for static resource (#17305) (#…
fix: handle spring boot relative path for static resource (#17305) (C…
vaadin-bot commentedon Aug 8, 2023
This ticket/PR has been released with Vaadin 24.2.0.alpha6 and is also targeting the upcoming stable 24.2.0 version.
vaadin-bot commentedon Aug 14, 2023
This ticket/PR has been released with Vaadin 23.3.20.
vaadin-bot commentedon Aug 14, 2023
This ticket/PR has been released with Vaadin 24.0.12.
vaadin-bot commentedon Aug 14, 2023
This ticket/PR has been released with Vaadin 24.1.5.