“<参数>"与“环境"相对应;Tomcat上下文中的条目 [英] "<Parameter>" versus "<Environment>" entries in a Tomcat Context

查看:71
本文介绍了“<参数>"与“环境"相对应;Tomcat上下文中的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文容器 页,我看到两个部分:

On The Context Container page of the Tomcat documentation, I see two sections:

此类元素的标准名称为< context-param> < env-entry> ,而Tomcat特定名称为<参数> < Environment> .

The standard names for such elements is <context-param> and <env-entry>, while the Tomcat-specific names are <Parameter> and <Environment>.

上下文参数环境条目似乎具有相同的简单工作,即为在该上下文中运行的servlet提供相同的值.例如,设置标志以传达某些条件.

Both Context Parameters and Environment Entries appear to have the same simple job of making same value available to the servlets running in that context. For example, setting a flag to communicate some condition.

上下文参数环境条目之间有什么区别?

➥为什么我选择使用一个而不是另一个?

➥ Why would I choose to use one instead of the other?

推荐答案

上下文参数和环境条目之间有什么区别?

What is the difference between Context Parameters and Environment Entries?

这与 Servlet规范相同:< context-param>vs< env-entry>在web.xml中??

我为什么选择使用一个而不是另一个?

Why would I choose to use one instead of the other?

我假设您的意思是为什么我会选择< Context> /< Environment> < context-param>/<; env-entry> ",而不是如何确定是否需要上下文参数或环境条目".如果您的问题是后者,那么您的问题确实是重复的.

I'm assuming that you mean "why would I choose <Context>/<Environment> versus <context-param>/<env-entry>" and not "how do I decide if I want a context parameter or an environment entry". If your question is the latter, than your question is indeed a duplicate.

META-INF/context.xml 中使用< Context> /< Environment> 它们在 WEB-INF/web.xml 中的相似之处归结为部署方案中的职责分离.一般来说,程序员是负责 WEB-INF/web.xml 内容的负责人,而管理员或操作人员是负责 META-INF/context的内容的负责人.xml .

The reason you might want to use <Context>/<Environment> in META-INF/context.xml versus putting their analogues into WEB-INF/web.xml comes down to separation of duties in a deployment scenario. Generally speaking, programmers are the ones who are in charge of the contents of WEB-INF/web.xml and administrators or operations staff are in charge of the contents of META-INF/context.xml.

操作员可以覆盖程序员指定的值,例如,配置文件的位置.在生产部署将配置文件放入/etc/时, WEB-INF/web.xml 可能指向〜/configs/app.conf 中的配置文件.foo/app.conf .

Operators can override values specified by programmers for, say, the location of a configuration file. WEB-INF/web.xml might point to a configuration file in ~/configs/app.conf while the production deployment puts that configuration file into /etc/foo/app.conf.

如果操作员不对应用程序的部署描述符进行即时更改会更好. META-INF/context.xml 允许他们在不更改部署描述符的情况下进行此类调整.

It's better if operators aren't making on-the-fly changes to an application's deployment descriptor. META-INF/context.xml allows them to make those kinds of adjustments without changing that deployment descriptor.

如果您是单人操作,或者每个人都是DevOps或其他人员,那么几乎没有关系.但是Tomcat使您可以灵活地实施要在自己的环境中实施的任何策略.

If you are a one-person operation or if everyone is DevOps or whatever, then it almost doesn't matter. But Tomcat gives you the flexibility to implement whatever policy you want to enforce in your own environment.

这篇关于“&lt;参数&gt;"与“环境"相对应;Tomcat上下文中的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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