我正在尝试获取从网络触发的代理的查询字符串参数:
http://myhost/mydb.nsf/myagent?open&reportID=96c6
使用 org.openntf.domino API 并运行 Domino 9 服务器 HF441 和 org.openntf.domino.xsp_1.0.0.201309021740
我得到这个例外:
[0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:org.openntf.domino.exceptions.UndefinedDelegateTypeException [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 org.openntf.domino.utils.Factory.getParentDatabase(Factory.ja 弗吉尼亚州:613) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 org.openntf.domino.impl.Document.(Document.java:109) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 org.openntf.domino.utils.Factory.fromLotus(Factory.java:251) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 org.openntf.domino.impl.AgentContext.getDocumentContext(代理 上下文.java:85) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 JavaAgent.NotesMain(JavaAgent.java:25) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 lotus.domino.AgentBase.runNotes(未知来源) [0D40:0045-1488] 2013-09-03 12:01:56 HTTP JVM:在 lotus.domino.NotesThread.run(未知来源)
import java.io.PrintWriter;
import java.util.Hashtable;
import org.openntf.domino.AgentBase;
import org.openntf.domino.AgentContext;
import org.openntf.domino.Database;
import org.openntf.domino.Document;
import org.openntf.domino.Session;
public class JavaAgent extends AgentBase {
boolean debug = false;
PrintWriter pw;
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
pw = getAgentOutput();
Database reportDB = session.getDatabase(session.getServerName(),
"report.nsf");
Document doc = agentContext.getDocumentContext();
String qs = doc.getItemValueString("Query_String");
Hashtable ht = CommonJ.parseQueryString(qs);
String reportID = (String) ht.get("reportID");
Document reportDoc = reportDB.getDocumentByID(reportID);
if (null != reportDoc) {
String filename = reportDoc.getFirstItem("$File")
.getValueString();
pw.println(reportDoc.getHttpURL() + "/$file/" + filename);
} else {
pw.println("<h2>Sorry, report not found!");
}
} catch (Exception e) {
pw.println("<h2>Sorry, report not found!");
pw.println(e);
e.printStackTrace();
}
}
}