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

View File

@ -734,9 +734,14 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
byte[] data=null;
String base = URIUtil.addPaths(request.getRequestURI(),URIUtil.SLASH);
// handle ResourceCollection
if (_resourceBase instanceof ResourceCollection)
resource=_resourceBase.addPath(pathInContext);
//If the DefaultServlet has a resource base set, use it
if (_resourceBase != null)
{
// 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)
resource=_contextHandler.getBaseResource().addPath(pathInContext);