Exemple #1
0
 /** 查看某个ruleset文件 */
 public void viewRuleset() throws Exception {
   try {
     // 文件名
     String fn = request.getParameter("file");
     fn = (String) application.getAttribute("Ruleset") + fn;
     // 读取文件内容
     String txt = ToolUtil.getFileConetent(fn, "UTF-8");
     // 设置HTTP头:
     response.setContentType("text/xml");
     // 写入内容
     out.write(txt);
     out.flush();
   } catch (Exception e) {
     echo(e.getMessage());
   }
 }
Exemple #2
0
 /** 下载某个ruleset */
 public void downRuleset() throws Exception {
   try {
     // 文件名
     String file = request.getParameter("file");
     String fn = (String) application.getAttribute("Ruleset") + file;
     // 读取文件内容
     String txt = ToolUtil.getFileConetent(fn, "UTF-8");
     // 设置HTTP头:
     response.reset();
     response.setContentType("application/octet-stream");
     response.addHeader("Content-Disposition", "attachment;" + "filename=\"" + file + "\"");
     // 写入内容
     out.write(txt);
     out.flush();
   } catch (Exception e) {
     echo(e.getMessage());
   }
 }