【问题标题】:Get web server site via Java agent in lotus notes?通过 Lotus Notes 中的 Java 代理获取 Web 服务器站点?
【发布时间】:2013-05-28 07:09:33
【问题描述】:

是否可以通过 Java 代理在 Lotus Web 服务器上动态创建网站规则(替换)?

【问题讨论】:

    标签: java lotus agent


    【解决方案1】:

    规则存储在“普通”Notes 文档中。这意味着您可以使用 Java 创建、编辑和删除此类规则(=文档)。

    如何做到这一点?

    手动创建一些网站规则,如 here 所示。

    然后在 Domino 目录数据库中查找已创建的网站规则文档,并使用 Files\Properties 发现这些文档中有哪些字段。然后您就会知道,文档必须看起来像您使用 Java 创建的那样。

    【讨论】:

      【解决方案2】:

      是的,有可能,但是:由于每个替换规则都需要重新启动 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 );
      

      【讨论】:

      • “因为每个替换规则都需要重新启动 http- 任务” 是的,我知道。请展示创建规则的方法。
      • 旁注:在大多数情况下,您可以执行“告诉 http 刷新”以更新规则(从而避免重新启动 HTTP)
      • 非常感谢,我使用以下代码: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) - 它工作正常
      • 当我手动创建这种类型的文档并导出它时,设置的字段比代码中提到的字段多得多。并非所有这些都肯定是必需的,但至少“RM_AccessLevel”值得一试。如果您不想“手动”填写所有字段,请尝试在 doc.save 之前添加 doc.computeWithForm(false, false)
      • 我还将 Type-Field 设置为“WebRule”,names.nsf 中的 Type-Fields 非常重要...
      猜你喜欢
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2012-11-07
      • 1970-01-01
      • 2021-12-16
      • 1970-01-01
      • 2010-10-19
      相关资源
      最近更新 更多