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