1 4 5 9 10 package org.openlaszlo.servlets.responders; 11 12 import java.io.*; 13 import javax.servlet.http.HttpServletRequest ; 14 import javax.servlet.http.HttpServletResponse ; 15 import javax.servlet.ServletOutputStream ; 16 import org.openlaszlo.data.JavaDataSource; 17 import org.openlaszlo.utils.FileUtils; 18 import org.apache.log4j.Logger; 19 20 public final class ResponderJAVARPCINFO extends ResponderAdmin 21 { 22 private static Logger mLogger = Logger.getLogger(ResponderJAVARPCINFO.class); 23 24 boolean ok(String opt) { 25 return opt != null && opt.equals("1"); 26 } 27 28 protected void respondAdmin(HttpServletRequest req, HttpServletResponse res) 29 throws IOException { 30 res.setContentType ("text/xml"); 31 ServletOutputStream out = res.getOutputStream(); 32 try { 33 if (ok(req.getParameter("clear"))) { 34 JavaDataSource.clearLoadInfo(); 35 } 36 37 int options = 0; 38 boolean doAll = ok(req.getParameter("opt_all")); 39 if (doAll || ok(req.getParameter("opt_invoke"))) 40 options |= JavaDataSource.LOAD_INVOKE; 41 if (doAll || ok(req.getParameter("opt_sgp"))) 42 options |= JavaDataSource.LOAD_STATIC_GET_PROTO; 43 if (doAll || ok(req.getParameter("opt_icp"))) 44 options |= JavaDataSource.LOAD_INSTANCE_CREATE_PROTO; 45 if (doAll || ok(req.getParameter("opt_igp"))) 46 options |= JavaDataSource.LOAD_INSTANCE_GET_PROTO; 47 if (doAll || ok(req.getParameter("opt_idp"))) 48 options |= JavaDataSource.LOAD_INSTANCE_DESTROY_PROTO; 49 if (doAll || ok(req.getParameter("opt_igit"))) 50 options |= JavaDataSource.LOAD_INSTANCE_GET_INVOKE_TARGET; 51 if (doAll || ok(req.getParameter("opt_roe"))) 52 options |= JavaDataSource.LOAD_RETURN_OBJECT_ENCODE; 53 out.println(JavaDataSource.toXML(options)); 54 } finally { 55 FileUtils.close(out); 56 } 57 } 58 59 public int getMimeType() 60 { 61 return MIME_TYPE_XML; 62 } 63 } 64 | Popular Tags |