1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import java.util.Properties ; 14 import javax.servlet.ServletConfig ; 15 import javax.servlet.ServletException ; 16 import javax.servlet.ServletOutputStream ; 17 import javax.servlet.http.HttpServletRequest ; 18 import javax.servlet.http.HttpServletResponse ; 19 import org.openlaszlo.utils.FileUtils; 20 import org.openlaszlo.server.LPS; 21 import org.apache.log4j.Logger; 22 23 public final class ResponderLOG extends ResponderAdmin 24 { 25 private static Logger mLogger = Logger.getLogger(ResponderLOG.class); 26 27 protected void respondAdmin(HttpServletRequest req, HttpServletResponse res) 28 throws IOException 29 { 30 ServletOutputStream out = res.getOutputStream(); 31 FileInputStream in = null; 32 try { 33 res.setContentType ("text/html"); 34 out.println("<html><head><title>LPS Log</title></head>"); 35 out.println("<body><pre>"); 36 File logFile = ResponderLOGCONFIG.getLogFile(); 37 if (logFile != null) { 38 in = new FileInputStream(logFile); 39 FileUtils.escapeHTMLAndSend(in, out); 40 } else { 41 out.println("No log file."); 42 } 43 out.println("</pre></body></html>"); 44 mLogger.info("Sent log"); 45 } finally { 46 FileUtils.close(in); 47 FileUtils.close(out); 48 } 49 } 50 51 public int getMimeType() 52 { 53 return MIME_TYPE_HTML; 54 } 55 } 56 | Popular Tags |