我正在尝试在我的存在数据库应用程序中使用 RESTXQ - 我们称之为“超级应用程序”。我将restxq触发器添加到/db/apps/superapp/collection.xconf:
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:xs="http://www.w3.org/2001/XMLSchema">
<fulltext default="none" attributes="false"/>
</index>
<triggers>
<trigger class="org.exist.extensions.exquery.restxq.impl.RestXqTrigger"/>
</triggers>
</collection>
然后我在文件夹 /db/apps/superapp/modules 中添加了一个文件“restxq-test.xql”:
xquery version "3.0";
module namespace test="http://exist-db.org/apps/restxq/test";
declare namespace rest="http://exquery.org/ns/restxq";
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare
%rest:GET
%rest:path("/super")
%output:media-type("text/html")
%output:method("html5")
%rest:query-param("user", "{$user}", "Guest")
function test:hello($user as xs:string*) {
let $title := 'Hello '
return
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$title}</title>
</head>
<body>
<h1>{$title , $user}</h1>
</body>
</html>
};
但是我如何让restxq“知道”这个新模块的存在呢?它显然不会自动这样做。如果我打电话给“xyz.com:8080/exist/restxq/super?user=John”,我会得到
HTTP ERROR 405
Problem accessing /exist/restxq/super. Reason:
HTTP method GET is not supported by this URL
我重新启动了 eXist 并检查了 /var/www/exist/webapp/WEB-INF/logs/restxq.log 但那里没有条目......我很确定函数和属性映射是正确的。如果我将相同的功能添加到“/db/apps/demo/examples/templating/restxq-demo.xql”(显然已注册),它就完美了。所以我猜新模块只是没有注册。我怎样才能做到这一点?