我从基于浏览器的Flex应用程序调用servlet,但得到以下异常:
Error #2044: Unhandled securityError:. text=Error #2170: Security sandbox violation: http://MyURL/web-player/WebPlayer.swf cannot send HTTP headers to http:/MyOtherUrl:1936/ImageUpload.
at WebPlayer/screenGrab()
at WebPlayer/__exportImageButton_click()
我从
提供以下crossdomain.xmlhttp://MyOtherUrl/
和
http://MyOtherUrl:1936/
(服务于servlet的端口)。
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain='*' headers="*" secure="false"/>
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>
我做错了什么?
编辑以包含代码
var urlRequest:URLRequest = new URLRequest();
urlRequest.url = "http://MyUrl:1936/ImageUpload";
urlRequest.contentType = 'multipart/form-data; boundary=' + UploadPostHelper.getBoundary();
urlRequest.method = URLRequestMethod.POST;
var params:Object = new Object();
params.userId = userId;
params.videoId = videoId;
urlRequest.data = UploadPostHelper.getPostData("splash.jpg", jpegStream, params);
urlRequest.requestHeaders.push( new URLRequestHeader( 'multipart/form-data', 'image/jpg' ) );
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(urlRequest);
答案 0 :(得分:0)
尝试检查您的crossdomain.xml是否可以从浏览器访问。 转到MyOtherUrl:1936 / crossdomain.xml
使用http://www.charlesproxy.com/检查流量 看看是什么错误。