简体   繁体   English

将 Apache Thrift 与 Apache Cordova 结合使用

[英]Combining Apache Thrift with Apache Cordova

I was wondering if anybody had any success with making a app with Cordova and then send an RPC call using Thrift.我想知道是否有人在使用 Cordova 制作应用程序然后使用 Thrift 发送 RPC 调用方面取得了任何成功。 I was trying to send a string to a C++ server from my phone on a different network but it wouldn't because of CORS.我试图从我的手机在不同网络上向 C++ 服务器发送一个字符串,但由于 CORS,它不会。 Anyway around this?无论如何围绕这个?

Cordova and Phonegap does NOT use or enforce CORS. Cordova 和 Phonegap 不使用或强制执行 CORS。 The security is handle a different way -- with white-list s.安全性以不同的方式处理——使用white-list s。

Here is what you need to know.这是您需要了解的内容。

From Top Mistakes by Developers new to Cordova/Phonegap you have hit:Cordova/Phonegap 新手开发者犯的主要错误中,您遇到了:

  • #10 Not adding the new "white-list" and "white-list plugin" parameters in config.xml. #10不在 config.xml 中添加新的“白名单”和“白名单插件”参数。

For #10对于#10

This relatively * NEW * requirement means – to access ANY website or resources on the web, you MUST use the whitelist and the whitelist plugin.这个相对*新*的要求意味着 - 要访问网络上的任何网站或资源,您必须使用白名单和白名单插件。 This requirement goes into affect if you are using cordova-android@4.0.0 or better;如果您使用的是cordova-android@4.0.0 或更高版本,则此要求会生效; including cli-5.1.1.包括 cli-5.1.1。 If however, your version is before 4.0.0, let use say 3.5.0 or 3.7.0, then you will not have to add the white-list requirement.但是,如果您的版本在 4.0.0 之前,比如说使用 3.5.0 或 3.7.0,那么您将不必添加白名单要求。

To be clear, the "whitelist" has been around for a bit, but the plugin and requirement is very new.需要明确的是,“白名单”已经存在一段时间了,但是插件和要求是非常新的。 As you would expect, when the "whitelist" was added, the defacto open-access feature was deprecated.正如您所料,当添加“白名单”时,事实上的开放访问功能已被弃用。 Or said another way, the defacto open-access feature was planned and scheduled to be eliminated.或者换句话说,事实上的开放获取功能已计划并计划被淘汰。 This change marks a step in removal of the open-access feature.此更改标志着移除开放访问功能的一步。

In addition, the Content Security Policy (CSP) has caught numerous developers - because it was soooo poorly publicized.此外,内容安全策略 (CSP) 已经吸引了许多开发人员 - 因为它的宣传很差。 This CSP needs to go in every single HTML page you used, just like you have to wait for 'deviceready'.这个 CSP 需要进入你使用的每一个 HTML 页面,就像你必须等待“deviceready”一样。 The documentation is buried in the bottom of many of the latest documentation pages.该文档隐藏在许多最新文档页面的底部。

Related Links相关链接

Phonegap Build Forum: Notes for upgrading to cli-5.1.1 on PGB and now required Whitelist Phonegap 构建论坛: 在 PGB 上升级到 cli-5.1.1 的注意事项,现在需要白名单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM