【问题标题】:PayPal: alternative to ConfigManager.getInstance().load()PayPal:ConfigManager.getInstance().load() 的替代品
【发布时间】:2013-06-04 12:18:27
【问题描述】:

我正在尝试通过关注this example 创建一个 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() 已被弃用,并且在我的项目中,配置文件不在默认位置,那么加载配置文件的正确方法是什么?

【问题讨论】:

标签: java paypal paypal-ipn


【解决方案1】:

可能的解决方案:

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

更多信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-08
    相关资源
    最近更新 更多