1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import java.net.URLEncoder ; 14 import java.util.Enumeration ; 15 import java.util.Properties ; 16 import javax.servlet.ServletConfig ; 17 import javax.servlet.ServletException ; 18 import javax.servlet.ServletOutputStream ; 19 import javax.servlet.http.HttpSession ; 20 import javax.servlet.http.HttpServletRequest ; 21 import javax.servlet.http.HttpServletResponse ; 22 import org.openlaszlo.compiler.Canvas; 23 import org.openlaszlo.compiler.CompilationError; 24 import org.openlaszlo.cm.CompilationManager; 25 import org.openlaszlo.utils.*; 26 import org.openlaszlo.xml.internal.XMLUtils; 27 import org.apache.log4j.Logger; 28 import org.openlaszlo.servlets.KrankListener; 29 30 public final class ResponderKRANKSTATUS extends ResponderAdmin 31 { 32 private static Logger mLogger = Logger.getLogger(ResponderKRANKSTATUS.class); 33 34 37 protected void respondAdmin(HttpServletRequest req, HttpServletResponse res) 38 throws IOException 39 { 40 String abort = req.getParameter("abort"); 41 String lps = req.getContextPath(); 42 String msg = req.getParameter("msg"); 43 String lzourl = StringUtils.replace(req.getRequestURI(), ".lzx", ".lzo"); 44 KrankListener kl = CompilationManager.sKrankListener; 45 res.setContentType("text/html"); 46 ServletOutputStream out = res.getOutputStream(); 47 48 if ("true".equals(abort)) { 49 CompilationManager.abortKrankProcess(); 50 String xmlString = "<abort " + 51 "lps=\"" + XMLUtils.escapeXml(lps) + "\" "; 52 if (msg != null) 53 xmlString += "msg=\"" + XMLUtils.escapeXml(msg) + "\" "; 54 xmlString += ">" + 55 ResponderAPP_CONSOLE.getRequestXML(req, null) + 56 "</abort>"; 57 String pathname = 58 org.openlaszlo.server.LPS.getTemplateDirectory() + 59 File.separator + "krank-abort.xslt"; 60 TransformUtils.applyTransform(pathname, xmlString, out); 61 } else { 62 if (kl.isBusy()) { 63 kl.setDuration(System.currentTimeMillis() - kl.starttime()); 64 } 65 String xmlString = "<krank " + 66 "appName=\"" + XMLUtils.escapeXml(""+kl.getAppname()) + "\" " + 67 "seconds=\"" + kl.getDuration()/1000 + "\" " + 68 "lzourl=\"" + lzourl + "\" "; 69 if (kl.isAborted()) 70 xmlString += "isAborted=\"" + XMLUtils.escapeXml(""+kl.isAborted()) + "\" "; 71 if (kl.isBusy()) { 72 xmlString += "isBusy=\"" + XMLUtils.escapeXml(""+kl.isBusy()) + "\" "; 73 } 74 if (kl.isFinished()) 75 xmlString += "isFinished=\"" + XMLUtils.escapeXml(""+kl.isFinished()) + "\" "; 76 if (kl.isIdle()) 77 xmlString += "isIdle=\"" + XMLUtils.escapeXml(""+kl.isIdle()) + "\" "; 78 xmlString += ">" + 79 ResponderAPP_CONSOLE.getRequestXML(req, null) + 80 "</krank>"; 81 String pathname = 82 org.openlaszlo.server.LPS.getTemplateDirectory() + 83 File.separator + "kranking.xslt"; 84 TransformUtils.applyTransform(pathname, xmlString, out); 85 } 86 FileUtils.close(out); 87 } 88 89 public int getMimeType() 90 { 91 return MIME_TYPE_HTML; 92 } 93 94 } 95 | Popular Tags |