【问题标题】:How to check browser ver/name from Lotus Notes Java agent?如何从 Lotus Notes Java 代理检查浏览器版本/名称?
【发布时间】:2016-09-27 03:11:44
【问题描述】:

假设这是不可能的。 当我通过浏览器运行代理时: http://www.xxxxxxx.com/mydb.nsf/MyAgent?OpenAgent

我想在这个 java MyAgent 中获取浏览器的名称/版本(即 HTTP_User_Agent)

有什么解决方法吗? 谢谢

【问题讨论】:

    标签: java lotus-notes lotus-domino


    【解决方案1】:

    最简单的方法是使用文档上下文。 您将获得一个文档,其中包含所有 CGI 变量作为项目。这是来自designer help的示例代码:

    import lotus.domino.*;
    
    public class JavaAgent extends AgentBase {
    
        public void NotesMain() {
    
            try {
              Session session = getSession();
              AgentContext agentContext = session.getAgentContext();
    
          // (Your code goes here) 
              Document doc = agentContext.getDocumentContext();
              System.out.println
            (doc.getItemValueString("http_user_agent"));
    
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    【讨论】:

    • 谢谢林克先生。那行得通.. 我只是使用了错误的 CGI 变量
    猜你喜欢
    • 2011-10-06
    • 1970-01-01
    • 2012-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-27
    • 2014-01-15
    相关资源
    最近更新 更多