未找到 javapns 文件

发布于 2024-12-20 06:46:12 字数 312 浏览 3 评论 0原文

我尝试使用 javaPns 将推送通知发送到我的设备,但如果我尝试使用不在我的服务器上而是在外部服务器上的证书,我会收到文件未找到异常。 我认为这是因为 javaPns 使用

new FileInputStream(path)

而不是

InputStream is = new URL("http://stackoverflow.com/").openStream();

有没有一种方法可以使用外部服务器而不修改 javaPNS 代码?

谢谢 4 你的帮助

I try to use javaPns to send push notifications to my device, but I get a file not found exception if I try to use a certificate which is not located on my server but on an external server.
I think this is because javaPns uses

new FileInputStream(path)

instead of

InputStream is = new URL("http://stackoverflow.com/").openStream();

is there a way to use an external server without modify the javaPNS code?

THX 4 your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瞎闹 2024-12-27 06:46:12

如果您使用的是 JavaPNS 2,则可以为密钥库提供一个InputStream而不仅仅是本地文件路径)。只需按照您在问题中所写的方式创建一个 InputStream,并将其传递给任何需要密钥库的 JavaPNS 方法。有关更多信息,请参阅图书馆的在线文档。

If you are using JavaPNS 2, you can provide an InputStream for the keystore (not just a local file path). Simply create an InputStream as you wrote in your question here, and pass it to any JavaPNS method that requires a keystore. See the library's on-line documentation for more information.

月依秋水 2024-12-27 06:46:12

嗯...你为什么要尝试使用来自另一台服务器的证书?

使用证书的全部目的是保证发送者的真实身份,而使用其他地方的证书完全违背了这一目的。

这就像问为什么我不能用邻居的钥匙进入前门一样。

证书非常小...如果您正在尝试扩展并且不希望代码中包含证书,请将证书放入数据库中并从那里读取它。

但是,嘿,我不是你......

让我们看看开发人员怎么说:
http://code.google.com/p/javapns/issues/detail ?id=94

Um... why are you trying to use a certificate from another server?

The whole point of using certificates is to guarantee that the sender is who the say they are, and using a certificate from somewhere else completely defeats that purpose.

It's like asking why I can't get in my front door with my neighbors key.

The cert is very small... If you are trying to scale and don't want the cert in your code, then put the certificate in your database and read it from there.

But hey, I'm not you...

Let's see what the developers say:
http://code.google.com/p/javapns/issues/detail?id=94

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文