private static void response_not_found(EventLoader event_loader, String path) { event_loader.response().setStatus(HttpServletResponse.SC_NOT_FOUND); String _404_file = event_loader.context.getRealPath("/WEB-INF/lizar/404.") + event_loader.postfix(); Resource file = file_map.get(MyMath.encryptionWithMD5(_404_file)); if (file == null) { if (StringHelper.isNull(event_loader.postfix())) event_loader.postfix("html"); File f = new File( event_loader.context.getRealPath("/WEB-INF/lizar/404.") + event_loader.postfix()); if (!f.exists()) { try { FileTool.write_to_file("404 page for default postfix", f); } catch (IOException e) { event_loader.log.error(path + " read exception.", e); } } read_file_in_not_found(event_loader, f); } else write(file.list, event_loader); }
public static void handle_abs_file(EventLoader event_loader, String path, boolean need_cache) { HttpServletResponse response = event_loader.response(); response.setContentType(ContentType.is(event_loader.postfix())); response.setCharacterEncoding(Controller.encode_type); if (need_cache) { Resource file = file_map.get(MyMath.encryptionWithMD5(path)); if (file != null) { file.use++; write(file.list, event_loader); } else { read_file(event_loader, path, need_cache); } } else { read_file(event_loader, path, need_cache); } }