Tomcat的context.xml文件,有没有一个hiearchy? [英] Tomcat context.xml files, is there a hiearchy?
问题描述
我想在Tomcat5上运行的应用程序中使用符号链接。感谢另一个StackOverflow问题的帮助,我能够做到
在
I am trying to use symbolic links in one of the applications I have running on Tomcat5. Thanks to some help from another StackOverflow question I was able to do it by creating a context.xml file in
/ ... myapplication / META-INF / context.xml
/...myapplication/META-INF/context.xml
我现在试图在生产服务器上实现这一点。但是,还有其他应用程序正在运行。还有另一个上下文文件
I am now trying to implement this on a production server. However, there are other applications running on it. And there is another context file
/ ... tomcat / conf / context.xml
/...tomcat/conf/context.xml
我这些是将服务器范围的配置设置到所有应用程序。如果我在conf / context.xml文件中允许链接,我的符号链接工作。如果我不在conf / context.xml中allowLinks,我的应用程序的符号链接不工作,即使我已经允许他们在META-INF / context.xml
It seems to me these are setting configurations server-wide to all applications. If I allowLinks in the conf/context.xml file, my symbolic links work. If I don't allowLinks in conf/context.xml, my application's symbolic links do not work, even though I have allowed them in the META-INF/context.xml
我的问题是,conf / context.xml是否控制所有应用程序?如果我想要符号链接仅在一个应用程序中工作,我需要删除conf / context.xml并为每个应用程序创建新的上下文文件?还是有一种方法,我只能在myapplication中允许符号链接?
My question is, does the conf/context.xml control all applications? If I want symbolic links to work only in one application, do I need to remove the conf/context.xml and create new context files for each application? Or is there a way I can allow symbolic links in myapplication only?
推荐答案
请参阅我的回答到哪个Tomcat 5上下文文件优先问题。
关于您的特定 allowLinks
问题, conf / context.xml
中的值默认为优先。如果你在 conf / context.xml
中没有说什么,默认值为 conf / context中使用config / context.html#Standard%20Implementationrel =nofollow noreferrer> allowLinks =false
.xml 。
Regarding your specific allowLinks
question, the value in conf/context.xml
takes precedence by default. If you say nothing in your conf/context.xml
, the default value is allowLinks="false"
in your conf/context.xml
.
如果您只想为 myapplication
在 META-INF / context.xml
中的< Context allowLinks =true...&因为 > c / conf / context.xml
设置将优先。
If you want to change it only for your myapplication
, trying to say <Context allowLinks="true" ...>
in your META-INF/context.xml
will have no effect because normally the conf/context.xml
setting will take precedence.
但是,如果您在<$ c $中表示< Context allowLinks =true override =true ...>
c> META-INF / context.xml ,然后在 META-INF / context中的所有
将最高优先级,覆盖< Context>
.xml conf / context.xml
中的任何内容。
But, if you say <Context allowLinks="true" override="true" ...>
in your META-INF/context.xml
, then all your <Context>
settings in META-INF/context.xml
will be highest precedence, overriding anything in conf/context.xml
.
最后,我建议使用 conf / Catalina,而不是
文件。这种技术意味着你可以保持你的WEB-INF的内容清洁,这是你的webapp的胆量 - 我不喜欢冒险在我的webapp的胆量。 : - ) myapplication / WEB-INF / context.xml
/localhost/myapplication.xml
Finally, instead of a myapplication/WEB-INF/context.xml
file, I recommend using a conf/Catalina/localhost/myapplication.xml
file. This technique means you can keep the contents of your WEB-INF clean, which is the guts of your webapp -- I don't like to risk mucking about in the guts of my webapp. :-)
这篇关于Tomcat的context.xml文件,有没有一个hiearchy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!