我需要从我的 java 类向 Android 客户端发送推送通知。该类是使用以下网址提供的指南编写的:http://www.vogella。 de/articles/AndroidCloudToDeviceMessaging/article.html(第 2.4 节 - 发送消息)这在 JBOSS 和 Weblogic 等标准应用程序服务器上运行良好。
但应用程序需要移至 google app-engine,但该类会抛出编译错误:“GAE 的 Java 运行时环境不支持类 javax.net.ssl.HostnameVerifier”。 “SSLSession”类也会引发类似的错误。
有没有办法克服这个问题?或者是否有其他方法可以从应用程序引擎上运行的 Java 类发送推送通知?
谢谢,
维奈
I have the requirement to send a PUSH notification to an android client from my java class. The class has been written using the guidelines provided at the url : http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html (Section 2.4 - Send Messages) This works fine on the standard application servers like JBOSS and Weblogic.
But the application needs to be moved to google app-engine but the class throws a compilation error saying : 'The class javax.net.ssl.HostnameVerifier is not supported by GAE's Java runtime environment'. Similar error is thrown for 'SSLSession' class too.
Is there a way this can be overcome ? Or is there is any other way to send PUSH notifications from Java classes running on the app-engine ?
Thanks,
Vinay
发布评论
评论(2)
它无法直接克服,这意味着您无法让这些课程在 GAE 上运行。至于解决方案,我不确定您为什么要使用自定义 HostnameVerifier,因此只需尝试不使用它:使用
HttpURLConnection
而不是HttpsURLConnection
并删除所有“主机名验证器”部分。编辑:您还可以使用 App Engine 的 fetch API,这是肯定支持的。
It can't be overcome directly, meaning you can't make those classes run on GAE. As for a solution, I'm not sure why you would want to use a custom HostnameVerifier, so just try without it: use
HttpURLConnection
instead ofHttpsURLConnection
and remove all the "hostnameVerifier" parts.Edit: you can also use App Engine's fetch API, that is supported for sure.
关于您的问题
是否有其他方法可以从应用程序引擎上运行的Java类发送PUSH通知?
,答案是肯定的,第三方服务,例如Beaconpush 或 Spire.io 可以与应用程序引擎,在某些情况下可能会便宜得多与使用 App Engine Channel API 相比,成本方面。Regarding your question
Is there is any other way to send PUSH notifications from Java classes running on the app-engine?
, the answer is yes, third party services such as Beaconpush or Spire.io could be integrated well with app engine, and in some cases could be much cheaper in terms of cost compared to using the App Engine Channel API.