需要任何人的建议。
if you look at the below code,every time I am creating the new object for smooks as ftlname dynamically get populated.
try {
Smooks smooks1 = new Smooks("smooks-config.xml");
if (ftlName != null) {
inputStream = new ByteArrayInputStream(xmlMessage.toString()
.getBytes());
outStream = new ByteArrayOutputStream();
smooks1.addVisitor(new FreeMarkerTemplateProcessor(
new TemplatingConfiguration(ftlName)));
smooks1.filterSource(new StreamSource(inputStream),
new StreamResult(outStream));
resultString = outStream.toString();
inputStream.close();
outStream.close();
}
} catch (Exception ee) { }
每次创建 smooks 对象时,当我尝试使用单个 smooks 实例时,这确实达到了性能,低于错误。
java.lang.UnsupportedOperationException: Unsupported call to Smooks instance configuration method after Smooks instance has created an ExecutionContext.
at org.milyn.Smooks.assertIsConfigurable(Smooks.java:588) [milyn-smooks-all-1.5.1.jar:]
at org.milyn.Smooks.addVisitor(Smooks.java:262) [milyn-smooks-all-1.5.1.jar:]
at org.milyn.Smooks.addVisitor(Smooks.java:241) [milyn-smooks-all-1.5.1.jar:]
can you please provide your advice on it.
smooks version :- 1.5.1