URLLoader的Flex请求在服务器端没有得到很好的接收

时间:2011-12-15 17:01:18

标签: actionscript-3 web-services flex networking urlencode

今天的问题涉及使用加密字符串的URLLoader请求。

当我加密字符串时,我得到以下结果:

1Kx4dfp5OC7ox0zb0lWzzzlnoPLcoPGE1MrAKOtl3h6SPcFmEdpLnUROSKpPrCl70VHRxrKzhsxHHlb1MRp3++JkvYZ++ghBEG2zbVhyaqQ/0+NDrJ+0cLt3g9THe9POohN6Ufcq9TcnmZVvIFXllg4HrjVNfQrhQCNwxuBgWBf2DRc4eq6hKzEgyLdlllQFc9ssUFlPD3wOBqoI22r+7N82sI3pqsQYBq5VlKHHreqD8Cq0gictnTFS3IqepASGARKyuCIPDCa4zE76VeQV5zgvkFfjDww+C1uZ8PUgjH67DKYqUP9a6euf2v1jUpBrREnm4ZbLAXScDjvrJ11rWYyVXOLZy9nhy9qRBQRvdw+tnBThPTmvxaq+LAusF8IbvDpZgMrZ3buvThnXuSBGXZxaja7fk/FIlm4RSliDTSGySiizFHy7dJePXuV0c9MI6ciOYxmEIg64NnhBZtB8wipUDJWOpoytOD2/sNQBenjZbYN8291msYnbBG+alAOQmEBH5Mn4KyW1VQWE2lBGk9ML+SflND8UXfdHz5Q3psOcMZJxSAURKGq5tjA8KlPPOAdQuVPIcysg2/4lV25QGIdDttQVGrkP+ZHZcHIPTLLD+Vml+PJU/OAJGNPGlf3wawUo+bID0FKur8N6tNyu7Pnoocn7plDi6WSJgUAaYjI4=

我发送它,Flex的一切似乎都很好。但是当我去服务器端(日志文件,不允许更改服务器端代码)来检查我得到的内容时,我最终得到了这个:

1Kx4dfp5OC7ox0zb0lWzzzlnoPLcoPGE1MrAKOtl3h6SPcFmEdpLnUROSKpPrCl70VHRxrKzhsxHHlb1MRp3  JkvYZ  ghBEG2zbVhyaqQ/0 NDrJ 0cLt3g9THe9POohN6Ufcq9TcnmZVvIFXllg4HrjVNfQrhQCNwxuBgWBf2DRc4eq6hKzEgyLdlllQFc9ssUFlPD3wOBqoI22r 7N82sI3pqsQYBq5VlKHHreqD8Cq0gictnTFS3IqepASGARKyuCIPDCa4zE76VeQV5zgvkFfjDww C1uZ8PUgjH67DKYqUP9a6euf2v1jUpBrREnm4ZbLAXScDjvrJ11rWYyVXOLZy9nhy9qRBQRvdw tnBThPTmvxaq LAusF8IbvDpZgMrZ3buvThnXuSBGXZxaja7fk/FIlm4RSliDTSGySiizFHy7dJePXuV0c9MI6ciOYxmEIg64NnhBZtB8wipUDJWOpoytOD2/sNQBenjZbYN8291msYnbBG alAOQmEBH5Mn4KyW1VQWE2lBGk9ML SflND8UXfdHz5Q3psOcMZJxSAURKGq5tjA8KlPPOAdQuVPIcysg2/4lV25QGIdDttQVGrkP ZHZcHIPTLLD Vml PJU/OAJGNPGlf3wawUo bID0FKur8N6tNyu7Pnoocn7plDi6WSJgUAaYjI4=
乍一看它们是相同的,但是如果仔细检查,+会被空格替换......

我甚至尝试切换+ for%2B但是在服务器端它被读取为%2B,它没有转换为+(在这种情况下,flex似乎不像浏览器那样)

非常感谢任何有关此事的见解和帮助。

请求的完成如下:

public function callService(callback:String, request:String):void{
        var url:URLRequest = new URLRequest(server);
        var requestedString:String = handlePluses(request);
        url.useCache = false;
        url.contentType = contentType;
        url.method = method;
        trace("sending: " + requestedString);
        url.data += requestedString);
        serverURL.addEventListener(IOErrorEvent.IO_ERROR, treatIO);
        serverURL.dataFormat = URLLoaderDataFormat.TEXT;
        serverURL.addEventListener(Event.COMPLETE, loadData);   
        serverURL.addEventListener(Event.CONNECT, function():void{trace("connected");});
        try{        
            serverURL.load(url);
        }catch(e:ArgumentError){trace("ArgError: " + e.message);}
        catch(e:SecurityError){trace("SecError: " + e.message);}
        catch(e:TimeoutEvent){trace("===========<Timeout>===========");}
    }

1 个答案:

答案 0 :(得分:0)

我们通过使用\&\#等转义字符的子集切换+字符来解决此问题。

这可能是其他人尝试同样的事情并试图保持最小尺寸的问题。