1

我正在尝试按照以下示例创建 IPN 侦听器:

public class IPNListenerServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ConfigManager.getInstance().load(this.getClass().getResourceAsStream("/sdk_config.properties"));
        IPNMessage  ipnlistener = new IPNMessage(request);
        boolean isIpnVerified = ipnlistener.validate();
        String transactionType = ipnlistener.getTransactionType();
        Map<String,String> map = ipnlistener.getIpnMap();

        LoggingManager.info(IPNListenerServlet.class, "******* IPN (name:value) pair : "+ map + "  " +
                "######### TransactionType : "+transactionType+"  ======== IPN verified : "+ isIpnVerified);
    }
}

但是ConfigManager.getInstance().load()已弃用,并且在我的项目中,配置文件不在默认位置,那么加载配置文件的正确方法是什么?

4

1 回答 1

1

可能的解决方案:

  1. 在默认位置提供一个空的 sdk_config.properties;
  2. 手动加载属性文件,获取相关映射并传递给IPNMessage构造函数;

更多信息在这里

于 2013-06-29T08:45:54.697 回答