diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java index 54f451a82d6..d0b88b1aa19 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExcludeSet.java @@ -187,6 +187,11 @@ public class IncludeExcludeSet implements Predicate

return !_includes.isEmpty(); } + public boolean hasExcludes() + { + return !_excludes.isEmpty(); + } + public int size() { return _includes.size() + _excludes.size(); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java index 4ecc50f8ecd..cdb4a57efad 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.util.resource; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; @@ -384,10 +385,9 @@ public class PathResource extends Resource @Override public InputStream getInputStream() throws IOException { - if (Files.isDirectory(path)) - throw new IOException(path + " is a directory"); - - return Files.newInputStream(path, StandardOpenOption.READ); + // Use a FileInputStream rather than Files.newInputStream(path) + // since it produces a stream with a fast skip implementation + return new FileInputStream(getFile()); } @Override diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClassMatcher.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClassMatcher.java index 533b878bfa9..975aa01648a 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClassMatcher.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClassMatcher.java @@ -758,14 +758,13 @@ public class ClassMatcher extends AbstractSet return false; URI uri = location.get(); - if (uri != null) - { - Boolean byLocation = locations.isIncludedAndNotExcluded(uri); - if (Boolean.FALSE == byLocation) - return false; + if (uri == null) + return locations.isEmpty() || locations.hasExcludes() && !locations.hasIncludes(); - return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes()); - } - return false; + Boolean byLocation = locations.isIncludedAndNotExcluded(uri); + if (Boolean.FALSE == byLocation) + return false; + + return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes()); } }