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

1 篇文章 0 订阅

在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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值