Issue #15228 - Deprecate use of newResource() during webapp started phase.#15231
Merged
joakime merged 7 commits intoJun 12, 2026
Merged
Conversation
…hase. Only valid use of newResource() is during webapp setup or initialization.
lorban
requested changes
Jun 5, 2026
lorban
requested changes
Jun 9, 2026
lorban
left a comment
Contributor
There was a problem hiding this comment.
There are still pending comments, but that change is almost there.
lorban
requested changes
Jun 10, 2026
lorban
left a comment
Contributor
There was a problem hiding this comment.
If you copy/adapt the ServletContextHandlerTest changes to EE9 and EE10 then this LGTM.
| Object trackedResources = mbeanServer.getAttribute(objectName, "trackedResources"); | ||
| assertNotNull(trackedResources); | ||
| assertThat(trackedResources, instanceOf(List.class)); | ||
| if (trackedResources instanceof List<?> trackedList) |
Contributor
There was a problem hiding this comment.
You could just cast trackedResources to List, but fine.
lorban
approved these changes
Jun 12, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
With the removal of
FileSystemPool(PR #14826), theResourceandResourceFactoryAPIs are more strict in usage.The old techniques (pre Jetty 12) where a call to
newResource()andresolve()were identical in behavior are no longer true.Any call to
newResource()has the potential to create a newFileSystemobject instance (true for non-fileschema URIs, likejar:file:///path/to/foo.jar, orresources://, orbundle://, etc)That means we need to stop using
newResource()during the started phase in a webapp, and only rely on theresolve()methods to find new JettyResourceobjects.This PR deprecates all of the various
newResource()APIs that can be used during the started phase of a webapp, and changes all of the calls to these newly deprecated APIs to use the appropriate API based on the when theResourceis needed, and for how long it is being tracked.