jetty.project
jetty.project copied to clipboard
Jetty 12 : Avoid recreating `Resource` during container/jar pattern filtering in `MetaInfConfiguration`
This fixes a few things with the URI matching done in MetaInfConfiguration against the regex from CONTAINER_JAR_PATTERN and WEBINF_JAR_PATTERN.
- The old
PatternMatcherusage introduced an extra unnecessarynewResource()call - The regex patterns need to work against the container of a
jar:file://URI, not thejar:file:URI itself.
The fix here was to avoid converting a List<Resource> to List<URI> and then URI[] to just match against the provided patterns, which then does a resourceFactory.newResource(URI) on the pre-existing Resource to then add it to another List<Resource>.
Introducing UriPatternPredicate to standardize the selection logic from PatternMatcher, and have PatternMatcher use it.
Creating ResourceUriPatternPredicate specific implementation to to allow filtering of resources by their URI
Reworked MetaInfConfiguration to filter Lists of Resources using these new classes to test againt the archive container, and to avoid recreating the Resource object.