在Phonegap / cordova Android APP中使用内容安全策略连接REST API的正确方法是什么(What is the right way of connect to a REST API with content security policy in a Phonegap/cordova Android APP)
我已经成功开发了一个Phonegap混合应用程序,它在模拟器上运行良好但在安装在Android设备上时无法发布到远程服务器。 我配置了白名单插件,我的config.xml包含
<plugin name="cordova-plugin-whitelist" version="1" /> <access origin="*"/> <allow-navigation href="http://*/*"/> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform>
我的索引页面包含
<meta http-equiv="Content-Security-Policy" content="default-src 'self' gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src *; connect-src *">
我正在使用Cordova 5.3.3,但似乎没有任何效果。
请任何人告诉我我做错了什么。 谢谢
I have successfully developed a Phonegap hybrid App, it worked well on emulators but unable to post to a remote server when installed on android device. I configured white list plugin and my config.xml contains
<plugin name="cordova-plugin-whitelist" version="1" /> <access origin="*"/> <allow-navigation href="http://*/*"/> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform>
and my index page contains
<meta http-equiv="Content-Security-Policy" content="default-src 'self' gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src *; connect-src *">
I am using Cordova 5.3.3 but yet nothing seems to work.
Please can anybody tell me what I am doing wrong. Thanks
原文:https://stackoverflow.com/questions/35644815
满意答案
将泛型参数移动到接口而不是方法:
public interface ITableData<T> where T : TableData { List<T> ListAll(); void Insert(Object o); } public class BookData : ITableData<Book> { public List<Book> ListAll() { List<Book> bookList =XXXXXX; //some code here return bookList; } }
Move the generic argument to the interface instead of on the method:
public interface ITableData<T> where T : TableData { List<T> ListAll(); void Insert(Object o); } public class BookData : ITableData<Book> { public List<Book> ListAll() { List<Book> bookList =XXXXXX; //some code here return bookList; } }
相关问答
更多包装时间通用功能(Wrapper to time generic function)
接口实现和通用功能(Interface implementation and common function)
带开关的通用功能(Generic function with switch)
用于简化代码的通用功能(generic function for simplified code)
通用功能接口(Generic functional interface)
通用功能签名(Generic function signatures)
C#试图简化通用类型接口的通用扩展功能(C# trying to simplify Generic Extension Function for Generic Typed Interface)
半通用功能(Semi-generic function)
返回Java 8中的通用功能接口(Return generic functional interface in Java 8)
与通用功能的接口(Interface with generic function)
相关文章
更多phonegap分享到微信插件(安卓版)
phonegap与微信开放平台接口整合
phonegap分享到微信插件(iOS版)
传说中的WeixinJSBridge和微信rest接口
怎么用spring security?
Spring Data: a new perspective of data operations
Stack Overflow Architecture Update - Now At 95 Million Page Views A Month
android 集成所有分享平台
Becoming a data scientist
A Great List of Windows Tools
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!