我在ColdFusion项目中使用antiSami。我正在通过onApplicationStart()加载antiSami,如下所示:

local.jarsArray =
[
    expandPath("lib/antisami/antisamy-1.4.4.jar")
];
application.antiSamiPolicyPath = expandPath("lib/antisami/antisamy-slashdot-1.4.4.xml");

application.javaLoader = createObject("lib.javaloader.JavaLoader").init(local.jarsArray);
application.antiSami = application.javaLoader.create("org.owasp.validator.html.AntiSamy").init();


如果转储application.antiSami,则可以看到antiSami对象。但是,一旦添加以下行:

local.result = application.antiSami.scan("some text", application.antiSamiPolicyPath);

我收到以下通用浏览器500消息:

Server Error, HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

在后台,我通过CFBuilder发现了此错误:

"Error","web-4","06/14/11","15:27:04","80BBF6B60584F6D148A7DC2A12007C03","org/apache/batik/css/parser/ParseException The specific sequence of files included or processed is: C:\ColdFusion9\wwwroot\gamers\index.cfm, line: 25 "

有什么想法是关于这个错误的吗?

最佳答案

事实证明,使用AntiSamy需要一定数量的依赖项:batik-css.jarbatik-util.jarnekohtml.jarxerceslmpl.jar。加载这些文件后,antiSamy应该可以正常工作,并且可以。

07-26 09:28