String pathTo = path.substring(0, lastSlash+1);
String name = path.substring(lastSlash+1);
if(Oscar3Props.getInstance().verbose) System.out.println(name);
ResourceGetter rg = new ResourceGetter(pathTo);
if(name.length() > 0 && !name.contains(".")) {
if(Oscar3Props.getInstance().verbose) System.out.println("Foo!");
if(Oscar3Props.getInstance().verbose) System.out.println(request.getServletPath());
response.sendRedirect(request.getServletPath() + request.getPathInfo() + "/");
return;
}
if(name.length() == 0) {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.write("<html><head><title>Oscar3 resources: " + path + "</title><head>");
out.write("<body><p>Oscar3 resources: <a href='..'>" + path + "</a></p><ul>");
for(String s : rg.getFiles()) {
String maybeSlash = "";
if(!s.contains(".")) {
maybeSlash = "/";
} else if(s.endsWith(".class") || s.equals("package.html") || s.equals("overview.html")) {
continue;
}
out.write("<li><a href='" + s + maybeSlash + "'>" + s + "</a></li>");
}
out.write("</ul></body></html>");
return;
}
if(name.endsWith(".txt")) {
String out = rg.getString(name);
response.setContentType("text/plain");
response.getWriter().println(out);
} else if(name.endsWith(".xml")) {
String out = rg.getString(name);
response.setContentType("application/xml");
response.getWriter().println(out);
} else if(name.endsWith(".xml")) {
String out = rg.getString(name);
response.setContentType("application/xslt+xml");
response.getWriter().println(out);
} else if(name.endsWith(".dtd")) {
String out = rg.getString(name);
response.setContentType("application/xml-dtd");
response.getWriter().println(out);
} else {
String out = rg.getString(name);
response.setContentType("text/plain");
response.getWriter().println(out);
}
} catch (Exception e) {