`
kingsleylong
  • 浏览: 54852 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Flex使用navigateToURL发起POST请求时遇到的问题

阅读更多

在ActionScript里面请求后台Servlet,代码如下

 

var url:String = "https://aserver:7002/testServlet?action=someAction";
var u:URLRequest = new URLRequest(url);
u.method = URLRequestMethod.POST;
var data:URLVariables = new URLVariables();
data.var1 = "1";
data.var2 = "2";
u.data = data;
navigateToURL(u,"_blank");

 

结果在后台获取var1, var2 的值为null。经后台debug发现,request是GET方式。但是把Weblogic端口改为Http端口后一切正常。最后把navigateToURL(u,"_blank"); 改成 navigateToURL(u,"_self"); ,问题解决。具体原因下面的帖子有详细的分析,其中有一段分析的不错:

另外,这个问题在IE上面才有,chrom上没有问题。可能不同浏览器之间的实现也有关系?求正解。。。

 

I don't see any obvious reason on why your parameters are not forwarded to the secured page. However I tried this scenario on my setup and here is what I found out.

If you are using self-signed certificate then Internet Explorer will show you warning page that it does not trust the certificate and this warning is shown before actually invoking your secure URL. At this point IE actually has lost all the parameters that you have passed in your POST request. Firefox seems to be smart since it reposts the request once you confirm the certificate warning message and hence it works on Firefox. But IE8 does not repost the request for some reason.

So once you confirm the certificate warning just hit refresh on your Flex application IE window again and it should work this time, test it.

I don't have any solution to this but workaround is to trust and install the certificate into your browser permanently and it should solve your problem for now.
分享到:
评论

相关推荐

    Flex企业应用开发实战源代码

    10.1.2 使用navigateToURL方法调用JavaScript 302 10.1.3 ExternalInterface API 303 10.2 在Flex中使用Flash CS所开发的控件 306 10.3 Flex访问.Net 308 10.3.1 Fluorine的安装和配置 309 10.3.2 Flex通过...

    Flex 编程技巧

    Flex 编程小技巧 1. 复制内容到剪贴板 1. System.setClipboard(strContent); 2. 复制一个 ArrayCollection 1. //dummy solution( well, it works ) 2. var bar:ArrayCollection = new ArrayCollection(); 3. for ...

    Flex 常用实现小功能的语句

    我做flex项目时收集的,与大家共享,共同进步。(如:页面重载: navigateToURL(new URLRequest("javascript:location.reload();"),"_self") 关闭浏览器:navigateToURL(new URLRequest("javascript:window.close()"),...

    flashbuilder4.5开发的查询qq好友是否在线

    flashbuilder4.5开发的查询qq好友是否在线,如果在线,点击即可跳出qq的交谈对话框 另外还搞清楚了Sprite如果想加到mxml文件中显示,必须加到另外的可视组件中才行

    flash+js交互部分

    flash CS4 actionscrpit 3.0 ... //navigateToURL(new URLRequest("javascript:getFlash()")); } ------------------------- 全部代码 js代码如下: function getflash() { alert('显示结果'); }

    以二进制形式读取外部图片文件(AIR)

    import flash.net.navigateToURL; import flash.net.URLRequest; import flash.utils.ByteArray; public class Main extends Sprite { private var rootMenu:NativeMenu = new NativeMenu; private var ...

    CS6打开歌词同步频谱播放器源码

    import flash.net.navigateToURL; import flash.net.URLRequest; import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; //===============// public class Main extends Sprite { private var...

Global site tag (gtag.js) - Google Analytics