String path = request.getRequestURI().getPath();
response.addHeader(HeaderName.CACHE_CONTROL, "max-age=300");
response.addHeader(HeaderName.CACHE_CONTROL, "public");
path = path.substring(requestURIPrefixLength, path.length());
StringTokenizer tokens = new StringTokenizer(path, "/");
PathNode currentBrowseNode = rootNode;
while (tokens.hasMoreTokens()) {
String currentToken = tokens.nextToken();
if (!tokens.hasMoreTokens()) {
selectBestChild(currentBrowseNode, currentToken,
request, response);
return;
} else {
currentBrowseNode = currentBrowseNode.getSubPath(currentToken);
}
}
throw new HandlerException(ResponseStatus.NOT_FOUND, "file "+path+" not found");
}