-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ensure that index.html works in any directory in native mode #39878
Conversation
geoand
commented
Apr 4, 2024
•
edited
Loading
edited
- Fixes: Routing for index.html fails with 404 for directories #39871
@@ -75,7 +75,15 @@ public void nativeImageResource(Optional<StaticResourcesBuildItem> staticResourc | |||
// TODO: do we perhaps want to register the whole directory? | |||
continue; | |||
} | |||
String metaInfResourcesPath = StaticResourcesRecorder.META_INF_RESOURCES + entry.getPath(); | |||
String path = entry.getPath(); | |||
int index = path.lastIndexOf("/index.html"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is index.html
the only default page name supported in JVM mode? What about index.htm
for example?
Thinking out loud: Why not registering all directory paths leading up to a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is index.html the only default page name supported in JVM mode? What about index.htm for example
Good point! It's actually configurable, so I'll use the config property
Thinking out loud: Why not registering all directory paths leading up to a file?
Because no one really needs them AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! It's actually configurable, so I'll use the config property
Actually the property is runtime... So there is not much we can do other than move the property to build time (which we would be a breaking change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or reconsider the
Because no one really needs them AFAIK.
part :)
If I get it right that would allow the users to still set the property at runtime and have it work for any file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That still would not be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, my understanding is that you were trying to cherry pick the directories with an index resource, which would be hard given you don't know the name of the index resource for sure at this point.
So my question is: I don't think it would cost much to register all directories in META-INF/resources
and simplify the problem.
And I don't foresee any bad side effects.
Or did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, now I see what you mean.
I support we could do that, it probably won't cost much of anything when it comes to native image size.
A follow up question to that approach would be whether we want to do this recursively or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think you need to do that recursively given an index.html
can be nested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW that was what I meant as well. +1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/StaticResourcesTest.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/StaticResourcesTest.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/StaticResourcesTest.java
Show resolved
Hide resolved
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/StaticResourcesTest.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Status for workflow
|