4,328
社区成员
发帖
与我相关
我的任务
分享
public function HTTPServiceTest():void{
Security.loadPolicyFile("http://10.100.3.16:8080/manager/crossdomain.xml");
var service:HTTPService=new HTTPService();
service.url="http://10.100.3.16:8080/manager/test/tomcat-users.xml";
service.headers["Authorization"]="Basic " + getEncodedAuthorization();
service.addEventListener("result", handler);
service.addEventListener("fault", handler);
service.send();
}
public function getEncodedAuthorization():String{
var encoder:Base64Encoder=new Base64Encoder();
encoder.insertNewLines=false;
encoder.encode("user:pass");
return encoder.toString();
}
<?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="*" to-ports="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>