} catch (CacheException e) {
reportError("Caching failed: " + queryPath, e, out);
return;
}
XQueryModule loadedModule = loaded.queryObject;
XQExpression body = loadedModule.getExpression();
if(body == null) {
return;
}
// set parameters
Enumeration<String> paramNames = req.getParameterNames();
while(paramNames.hasMoreElements()) {
String name = paramNames.nextElement();
String value = req.getParameter(name);
QualifiedName qname = QNameUtil.parse(name, XQSP_NSURI);
Variable var = loadedModule.getVariable(qname);
if(var != null && (var instanceof ExternalVariable)) {
var.setResult(XString.valueOf(value));
}
}
// execute
final Sequence<? extends Item> result;
try {
result = body.eval(null, new DynamicContext(loaded.staticEnv));
} catch (XQueryException e) {
reportError("Execution failed: " + queryPath, e, out);
return;
}
// serialize