我有一个我希望将我的应用转发到的DNS记录。我已经添加到$EXIST_HOME/webapp/WEB-INF/controller-config.xml
此行:
<root server-name="something.mydomain.com" pattern=".*" path="xmldb:exist:///db/apps/myapp"/>
这就是我在controller.xql中的app-root:
else if (contains($exist:path,"app-root")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}/{substring-after($exist:path, '$app-root/')}">
<set-header name='Cache-Control' value="no"/>
</forward>
</dispatch>
现在,当我将浏览器指向某个东西时。MyDomain.com,我正确地看到了DB/Apps/MyApp内容(仍在确定如何在该文件夹中获取index.html进行启动,但这是第二个问题(。somings.mydomain.com/index.html转换为'http://something.mydomain.com/exist/index.html',我看到了页面。但是,我丢失了所有指向图像,CSS样式等的链接。/img/banner.jpg'在浏览器中的HTML源中(。我已经将其更改为/resources/img/banner.jpg
,resources/img/banner.jpg
等,但我没有任何运气。不用说,在更改$EXIST_HOME/webapp/WEB-INF/controller-config.xml
之前,一切都很好地工作。我想念什么?
其他相关问题:
我没有在中指示的$EXIST_HOME/tools/jetty/etc/jetty.xml
中找到<Set name="contextPath">/exist</Set>
:NOSQL文档数据库和应用程序平台 book。我可以找到它吗,以便我可以删除URL的"存在"位?
好的,这部分是由于我对这个主题的无知以及我想要使用的某些文件的配置。因为我有
<root server-name="something.mydomain.com" pattern=".*" path="xmldb:exist:///db/apps/myapp/subfolder"/>
在我的$EXIST_HOME/webapp/WEB-INF/controller-config.xml
中,存在DB正在寻找/子文件夹内部的控制器。模块和配置文件(包括He Controller.xql(在MyApp文件夹中,因此novent-db使用了该控制器(由于子文件夹中没有控制器,因此控制器的请求倒回MyApp文件夹(。一旦将控制器放入子文件夹中,我就进行了编辑:
else if (ends-with($exist:resource, ".html")) then
(: the html page is run through view.xql to expand templates :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<view>
<forward url="../modules/view.xql"/>
</view>
<error-handler>
<forward url="../error-page.html" method="get"/>
<forward url="./modules/view.xql"/>
</error-handler>
</dispatch>
,以便我仍然可以从myApp文件夹中使用view.xql。
这只能部分解决问题,因为现在$ app-root不会被打开包装。例如,如果我的CSS在MyApp/Resources/CSS/中,并且从子文件夹目录中的文件中引用,则不会加载它。到目前为止,我唯一发现的解决方法是使用完整的http://地址每个CSS,JPG,JS等。有没有办法告诉Amot-DB在URL重写规则中指定的一个文件夹查看一个文件夹?我也尝试了:
else if (contains($exist:path,"app-root")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="xmldb:exist://db/apps/myapp">
<set-header name='Cache-Control' value="no"/>
</forward>
</dispatch>
,之后存在两个或三个斜线:不执行这些技巧(错误500(, forward url="http://fulladdress/db/apps/myapp"
也不是。
另外,现在
else if ($exist:path eq "/") then
(: forward root path to index.xql :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="index.html"/>
</dispatch>
在subfolder/controller.xql中正确地向前转发一个空的 $exist:path
到index.html。
最后,我设法找到了较新版本的现有db放置 <Set name="contextPath">/exist</Set>
代码的位置。它在eXist-db/tools/jetty/webapps/exist-webapp-context.xml
中。