我正在使用
CFM2WDDX
转换CF11中的数组,但我遇到了以下错误:
coldfusion.tagext.validation.WddxValidator$InvalidWddxPacketException:
WDDX数据包无效。。
我在这里使用此代码:
获取文件列表.cfm
<cfsetting enablecfoutputonly="Yes">
<cfset thisdir = ExpandPath(".\")>
<cfdirectory directory="#thisdir#" action="LIST" name="imagefiles" recurse="No">
<cfscript>
// get .gif|.jpg|.png files from the cfdirectory query...
numRows = imagefiles.recordcount;
imageFileArray = ArrayNew(1);
for (row = 1; row LTE numRows; row++) {
if (refindnocase("(.gif|.jpg|.png)",imagefiles.name[row]) neq 0) {
ArrayAppend(imageFileArray, imagefiles.name[row]);
}
}
</cfscript>
<cfwddx action="cfml2wddx" input=#imageFileArray# output="wddxText">
<cfoutput>#wddxText#</cfoutput>
正如你所看到的,代码创建了一个图像名称数组,然后我通过cfhttp访问它,以执行我需要的任何操作。我在CF9服务器上有相同的精确代码,具有相同的精确目录内容,工作正常,但在CF11中,我收到了格式错误。CF11中的这一功能是否发生了某种变化?
这是我用来访问上述代码的代码:
<cfhttp url="http://example.com/images/ClientLogos/getFileList.cfm" method="GET" timeout="10" throwonerror="Yes">
<cfwddx action="WDDX2CFML" input="#trim(cfhttp.filecontent)#" output="imageArray" validate="true">
<cfreturn imageArray>
这个
getFileList.cfm
与映像位于同一目录中,因此它在从中调用的本地服务器上执行。(这就是为什么我认为CF11可能是问题所在)
CF9的部分输出:
CF11的部分输出:
来自CF 11的CFHTTP.Header:
HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Access-Control-Allow-Origin: * Date: Tue, 31 Mar 2015 18:50:35 GMT Connection: close Content-Length: 10807
来自CF 9的CFHTTP.Header:
HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Vary: Accept-Encoding Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Tue, 31 Mar 2015 18:51:20 GMT Connection: close