this.rootDir = directory;
}
public Resource getResource(HttpContext context, String pathInContext) throws IOException {
File file = new File(rootDir, pathInContext);
Resource resource = createFileResource(file, context);
// Throw in a hack to make it easier to install user extensions
if (!resource.exists() && file.getName().equals(USER_EXTENSIONS_JS_NAME)) {
resource = userExtensionResource(context);
if (resource.exists()) return resource;
}
// And another hack to make the -htmlSuite appear in the /tests directory
if (!resource.exists() && pathInContext.startsWith(TEST_DIR)) {
File testFile = new File(rootDir, pathInContext.substring(TEST_DIR.length()));
resource = createFileResource(testFile, context);
if (resource.exists()) return resource;
}
return resource;
}