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

Static resources are missing when jar does not have a directory entry #27624

Closed
rstoyanchev opened this issue Oct 29, 2021 · 3 comments
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: regression A bug that is also a regression
Milestone

Comments

@rstoyanchev
Copy link
Contributor

The changes for #27538 include an optimization to filter out non-existing locations on startup. However, a jar may not have entries for directories, e.g. static/foo.gif exists but static/ does not, in which case the check for the existence of classpath:static/ fails and the location is filtered out. As indicated in #27538 (comment) this can be the case for externally created jars that are outside the control of an application. We need to improve the check or drop the optimization.

@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: regression A bug that is also a regression labels Oct 29, 2021
@rstoyanchev rstoyanchev added this to the 5.3.13 milestone Oct 29, 2021
@rstoyanchev rstoyanchev self-assigned this Oct 29, 2021
@jhoeller jhoeller self-assigned this Nov 10, 2021
@jhoeller
Copy link
Contributor

jhoeller commented Nov 10, 2021

I've introduced an optimizeLocations flag on ResourceHttpRequestHandler for resource location filtering on startup. This flag is off by default, addressing the regression, only to be enabled in case of a consistent jar layout with directory entries (potentially to be enabled by default in Boot).

@wilkinsona
Copy link
Member

Unfortunately, Boot can't guarantee directory entries. Static resources are often loaded from a jar in BOOT-INF/lib and its contents are out of Boot's control. This was the situation of the user who reported the regression, for example.

@jhoeller
Copy link
Contributor

Ok, then we'll have to leave it up to the user for the time being. Maybe we can set it in some scenarios eventually, or at least guide users towards that setting for web performance tuning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants