-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #10084 - Directory results from getResourcePaths(String)
should include trailing slash
#10085
Merged
joakime
merged 14 commits into
jetty-12.0.x
from
fix/12.0.x/getresourcepaths-dirs-with-trailing-slash
Jul 11, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a4f7c02
Issue #10084 - Directory entries on return of getResourcePaths(String…
joakime 8e4da80
Issue #10084 - Fixing test case order of entries in collection expect…
joakime e9e0780
Issue #10084 - Implementing fix for ee9
joakime ea80c52
Issue #10084 - Fixing bug in ServletContext.getRealPath() impl
joakime 1d7a62e
Issue #10084 - Fixing tests in ee9 to make them compatible with ee8 c…
joakime 96a3208
Issue #10084 - Correcting PathResource.getFileName
joakime 7875230
Issue #10084 - Fixing checkstyle
joakime 10fbabd
Issue #10084 - Updating URLResource.getFileName() support
joakime f57cb04
Issue #10084 - Reverting change to Resource.getFileName to return tra…
joakime 4927b1d
Issue #10084 - Introduce trailing slash only on ServletContext.getRes…
joakime 8172a46
Issue #10084 - Fixing comments
joakime b454bf5
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/12.0.x/ge…
joakime 7176fdc
Tweaking assertion
joakime 9d6679b
Issue #10084 - Addressing ResourceFactory usage review
joakime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
jetty-ee10/jetty-ee10-webapp/src/test/resources/wars/with_dirs/WEB-INF/bar/main.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is the "main.txt" in the /bar/ directory for war "with_dirs" |
1 change: 1 addition & 0 deletions
1
jetty-ee10/jetty-ee10-webapp/src/test/resources/wars/with_dirs/WEB-INF/foo/alt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is the "alt.txt" in the /foo/ directory for war "with_dirs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 it possible to resolve this within the resource classes? Previously the resource classes would have the trailing '/' on directories so it would be everywhere. Doing it just here as a post process risks not covering all usages.
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.
The Resource object returns a
List<Resource>
so I think perhaps the place would beResource.getFileName()
?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 getFileName, toString and anything else that returns the path as a string. Ideally even the URI should have the trailing slash. But
I don't think Path retains it.
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.
Turns out fixing
getFileName()
breaks a lot of test cases.See latest Jenkins build on this PR.
I'll noodle through them on monday.
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.
Would be good to check if any of these texts existed in jetty 11 and see if they were changed to not expect the trailing slash
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.
The Jetty 11
Resource.getName()
does not return the trailing slash on directories.However, the Jetty 11
Resource.list()
returns a String array, and that array has the trailing slash.The
Resource.list()
method in Jetty 11 is used ...Set<String>
on the Servlet APITurns out that in Jetty 12 we skip the String array step (eg: the Resource -> String array -> List of Resource -> iterate/process flow).
In Jetty 11, we don't rely on the results of
Resource.getName()
for anything critical, it seems to be used only for things like debugging, exception messages, keys in the annotation parser, etc.