0

我正在尝试获取从网络触发的代理的查询字符串参数:

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();
        }
    }
}
4

1 回答 1

1

我已经在我当前的分支中修复了这个问题。如果您要自己修改和从源代码构建,这就是变化:

https://github.com/OpenNTF/org.openntf.domino/commit/08d48763c22c6cdbb411d37e792a80c84e56eb34

Specifically, in the "getCurrentDatabase" method of org.openntf.domino.impl.AgentContext, change the final "this" in the "fromLotus" call to "getCurrentDatabase()".

Alternatively, I exported a jar from my dev environment that fixed it in my test (this is basically M3 plus a slight bit of work in the Design tree as well as this fix):

https://dl.dropboxusercontent.com/u/23599916/org.openntf.domino-jesse-20130903.jar

Let me know if you still run into trouble!

于 2013-09-03T10:55:07.103 回答