添加第二个Webapp [英] Adding a second webapp

查看:143
本文介绍了添加第二个Webapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在Moqui中建立一个公共网站,我正在尝试将(dev-)www.example.net作为公共营销网站和注册表单.然后在[tennant-name] .example.net上的租户中,设置了基本组件,然后编辑了MoquiDevConf .xml,如下所示修改了webapp-list:

I am struggling to setup a public website in Moqui, I am trying to have (dev-)www.example.net as the public marketing site and signup forms. Then the tennants on [tennant-name].example.net I have setup a basic component and then edited MoquiDevConf.xml, modified the webapp-list as shown below:

<webapp-list>
    <webapp name="webpublic" http-port="8080" https-enabled="false">
        <root-screen host="dev-www.example.net" location="component://webpublic/screen/webpublic.xml"/>
    </webapp>
    <webapp name="webroot" http-port="8080" https-enabled="false">
        <root-screen host="^((?!dev-www.example.net).)*$" location="component://webroot/screen/webroot.xml"/>
    </webapp>
</webapp-list>

我已重新启动应用程序以使更改生效,但是当我尝试访问

I have restarted the app for the changes to take effect but all I get is an error 500 when I try and visit http://dev-www.example.net:8080/

org.moqui.BaseException: Could not find root screen for host [dev-www.example.net]

据我所知Moqui正在查找组件,正如我在日志中看到的那样:

As far as I can tell Moqui is finding the component as I see this in the logs:

Added component [webpublic] at [file:/Volumes/MacHDD/Sources/atlas-moqui/runtime/component/webpublic] 

非dev-www主机仍然可以正常工作,并且我得到了惯常的登录屏幕,所以我不确定我丢失了什么,因为这几乎是现有Webroot的直接副本?

Non dev-www hosts still work and I get the customary login screen so I am not sure what I am missing as this is almost a direct copy of the existing webroot?

感谢您的帮助! 山姆

推荐答案

我对您的特定配置为何不起作用的猜测是root-screen.@ host属性始终是正则表达式,并且您使用的URL包含特殊字符.包括-"和."的字符.如果您使用'\'转义这些字符,即使用'.,它应该可以工作.和-".

My guess about why your particular configuration is not working is that the root-screen.@host attribute is always a regular expression and the URL you are using contains special characters including '-' and '.'. It should work if you escape these characters with a '\', i.e. use '.' and '-'.

也就是说,如果您要为多个租户支持具有相同webapp根目录的虚拟主机,则无需以这种方式声明虚拟主机,只有在您希望使用不同的webapp根目录屏幕(可能是您最终想要做什么).

That said, if you want to support virtual hosts with the same webapp root for multiple tenants you shouldn't need to declare the virtual hosts this way, this is only needed if you want a different webapp root screen (which may be what you eventually want to do).

更新:使用上面的配置代码片段,问题在于存在多个webapp-list.webapp元素,其中一个元素的名称= webroot,即所使用的webapp(如moqui-name上下文中的web.xml文件中所指定- param)和另一个name = webpublic的名称将被忽略,因为该配置是根据来自web.xml文件的名称找到的.

UPDATE: With the configuration snippet above the issue is that there are multiple webapp-list.webapp elements, one with name=webroot which is the webapp used (as specified in the web.xml file in the moqui-name context-param) and the other with name=webpublic which is ignored because the configuration is found based on the name from the web.xml file.

解决方案是将两个根屏幕元素都放在name = webroot的webapp元素下.基本上,查找这些内容的方式不是任意的,它对于webapp名称(moqui-name context-param)是明确的.如果您部署了多个Web应用程序,则它们应具有不同的moqui-name值以引用不同的配置.最好用Winstone以外的其他方式(例如Tomcat)来完成.它也会偏离记录的Moqui部署方式,因此需要做更多的工作.这样做没有任何意义,最好在同一Web应用程序中运行具有多个根屏幕元素和多个根屏幕的所有内容.

The solution is to put both root-screen elements under the webapp element with name=webroot. Basically the way these are looked up is not arbitrary, it is explicit for the webapp name (the moqui-name context-param). If you have multiple webapps deployed they should have different moqui-name values to refer to different configurations. This would best be done in something other that Winstone, something like Tomcat. It would also stray from the documented ways of deploying Moqui, so a bit more work would need to be done. There isn't any really point in doing this, better to run everything in the same webapp with multiple root-screen elements and multiple root screens as needed.

这篇关于添加第二个Webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆