379089 DefaultServlet ignores its resourceBase and uses context's ResourceCollection when listing diretories

This commit is contained in:
Jan Bartel 2012-05-10 11:30:04 +02:00
parent b281b037dd
commit ea557759b3
1 changed files with 8 additions and 3 deletions
jetty-servlet/src/main/java/org/eclipse/jetty/servlet

View File

@ -734,9 +734,14 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
byte[] data=null; byte[] data=null;
String base = URIUtil.addPaths(request.getRequestURI(),URIUtil.SLASH); String base = URIUtil.addPaths(request.getRequestURI(),URIUtil.SLASH);
// handle ResourceCollection //If the DefaultServlet has a resource base set, use it
if (_resourceBase instanceof ResourceCollection) if (_resourceBase != null)
resource=_resourceBase.addPath(pathInContext); {
// handle ResourceCollection
if (_resourceBase instanceof ResourceCollection)
resource=_resourceBase.addPath(pathInContext);
}
//Otherwise, try using the resource base of its enclosing context handler
else if (_contextHandler.getBaseResource() instanceof ResourceCollection) else if (_contextHandler.getBaseResource() instanceof ResourceCollection)
resource=_contextHandler.getBaseResource().addPath(pathInContext); resource=_contextHandler.getBaseResource().addPath(pathInContext);