【发布时间】:2013-05-28 07:09:33
【问题描述】:
是否可以通过 Java 代理在 Lotus Web 服务器上动态创建网站规则(替换)?
【问题讨论】:
是否可以通过 Java 代理在 Lotus Web 服务器上动态创建网站规则(替换)?
【问题讨论】:
规则存储在“普通”Notes 文档中。这意味着您可以使用 Java 创建、编辑和删除此类规则(=文档)。
如何做到这一点?
手动创建一些网站规则,如 here 所示。
然后在 Domino 目录数据库中查找已创建的网站规则文档,并使用 Files\Properties 发现这些文档中有哪些字段。然后您就会知道,文档必须看起来像您使用 Java 创建的那样。
【讨论】:
是的,有可能,但是:由于每个替换规则都需要重新启动 http- 任务,因此无法直接使用文档...
这是部分代码。在代理中执行以下操作:
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.replaceItemValue("Form", "WebRule" );
//.... WebRule documents can never stand alone, they have to be "attached" to a
//internetsite as Responses. I forgot about this in the first run.
Document docInternet = db.getDocumentByUNID( "PasteUNIDofInternetSiteDocumentHere" );
doc.makeResponse(docInternet);
//.... Fill the fields that you found out like explained by Knut Herrmann
doc.replaceItemValue( .... );
doc.replaceItemValue( .... );
doc.replaceItemValue( .... );
doc.replaceItemValue( .... );
// for lacy programmers who do not want to set all the hidden fields by themselves
doc.computeWithForm(false, false);
doc.save( true, true, true );
【讨论】:
doc.appendItemValue("Comment", "testingFromJA"); doc.appendItemValue("MappingType", 1); doc.appendItemValue("RM_MapFrom", "/remap"); doc.appendItemValue("RM_MapTo", "/yc_copy.nsf");,但在刷新 http 服务器后,当我尝试转到 mySiteName/remap 时出现错误 Http Status Code: 404 Reason: File not found or unable to read file。但是,当我手动创建规则替换 (/remapp - /yc_copy.nsf) - 它工作正常