// just another internal forward or even a direct call
String path = getRelativePath(request);
if (path.indexOf("/secstatic/") == 0) {
path = path.substring(10, path.length());
}
PathHandler handler = null;
String relPath = null;
String handlerName = null;
long start = 0;
boolean logDebug = Tracing.isDebugEnabled(StaticsLegacyDispatcher.class);
if (logDebug) start = System.currentTimeMillis();
try {
relPath = path.substring(1);
int index = relPath.indexOf('/');
if (index != -1) {
handlerName = relPath.substring(0, index);
relPath = relPath.substring(index);
}
if (handlerName != null)
handler = StaticsModule.getInstance(handlerName);
/*if (handler == null) {
handler = StaticsModule.getDefaultHandler();
relPath = path;
}*/
} catch (IndexOutOfBoundsException e) {
// if some problem with the url, we assign no handler
}
if (handler == null || relPath == null) {
// no handler found or relPath incomplete
response.sendError(HttpServletResponse.SC_NOT_FOUND, request
.getRequestURI());
return false;
}
ResourceDescriptor rd = handler.getResourceDescriptor(request, relPath);
if (rd == null) {
// no handler found or relPath incomplete
response.sendError(HttpServletResponse.SC_NOT_FOUND, request
.getRequestURI());
return false;
}
setHeaders(response, rd);
// check if modified since
long ifModifiedSince = request.getDateHeader("If-Modified-Since");
long lastMod = rd.getLastModified();
if (lastMod != -1L && ifModifiedSince >= lastMod) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return false;
}
// server the resource
if (copyContent) {
InputStream is = handler.getInputStream(request, rd);
if (is == null) {
// resource not found or access denied
response.sendError(HttpServletResponse.SC_NOT_FOUND, request
.getRequestURI());
return false;