GlassFish/Payara 4.x 中的 glassfish-application.xml 和 glassfish-web.xml 有什么区别?
What's the difference between glassfish-application.xml and glassfish-web.xml in GlassFish/Payara 4.x?
对于所有可以想象的实现对("What's the difference between Tomcat and GlassFish"、"What's the difference between GlassFish and JBoss" 等),Java EE 和 Web 配置文件之间的差异有大量解释,非常清楚大部头书。 glassfish-web.xml vs sun-web.xml vs web.xml as well as The difference between web.xml, beans.xml, applicationContext.xml, etc 有很好的问题,但它们都 link 到 GlassFish 3.x 文档[1]。
我想就
发表一些明确的声明
glassfish-application.xml
和 glassfish-web.xml
之间的优先级,这意味着一个优先于另一个(Web 优先于应用程序可能是合乎逻辑的,因为类加载顺序是相反的)还是从两者中选择选项?
- 我可以期望提取文件的可能位置。我假设
/
在应用程序的耳朵中, /WEB-INF/
在 war (耳朵内部)中用于应用程序描述符
- 是否可以在两个文件中指定任何可以在其他文件中指定的值,例如
web.xml
或 beans.xml
如果是,那么优先级是什么?
- war 打包(相对于 ear 打包)Java EE 应用程序的情况如何?
我认为 Payara 和 GlassFish 之间没有区别,因为前者被设计为直接替代品 - 事实上 documentation is practically not found by google 对于 Payara 和 GlassFish 4.x 是一样的。
[1] 这是 GlassFish 的 主要问题 - 大多数时候只有 3.x 文档可以通过手册、博客中的 link 获得和 SO 问题,您必须假设它可能无法正常工作,因为某些事情从 3.x 变为 4.x,这导致 n 个问题的复杂度为 2^n。
precedence between glassfish-application.xml and glassfish-web.xml, meaning does one override the other (it could be logical that web overrides application because the classloading order is inverted) or are options picked from both?
glassfish-application.xml
适用于 .ear
个文件,而 glassfish-web.xml
适用于 .war
个文件。对于 .ear
中的 .war
,glassfish-web.xml
将覆盖 glassfish-ejb.xml
.
中声明的设置
possible locations where I can expect the files to be picked up. I assume / in the ear for the application and /WEB-INF/ in the war (inside the ear) for the application descriptor
如果您的意思是文件应该位于何处,则 glassfish-application.xml
应该放在 .ear
的 META-INF
内,与 MANIFEST.MF
并排,而glassfish-web.xml
应放在 WEB-INF
内,与 beans.xml
.
并排
Is it possible to specify any values in both files which can be specified in other files, like web.xml or beans.xml and if yes, what's the precedence, then?
是的,标准的 JavaEE 部署描述符,因此 web.xml
、beans.xml
等受到尊重,但是如果有特定于服务器的部署描述符(即 glassfish-web.xml
),它们将被覆盖.
What's the situation in a war packaged (as opposed to ear packaged) Java EE application?
在 war 打包的应用程序中,您应该坚持使用 glassfish-web.xml
部署描述符。这将覆盖 JavaEE web.xml
部署描述符中设置的值,但两者都将被读取。
I assume that there's no difference between Payara and GlassFish because the former is designed to be a drop-in replacement - the fact that documentation is practically not found by google is the same for Payara as for GlassFish 4.x.
由于 Payara Server 派生自 GlassFish,我们仅记录扩展或修改默认行为的区域。因此,GlassFish 4 文档 https://javaee.github.io/glassfish/documentation4 can be used for any areas not mentioned within the Payara Server documentation https://docs.payara.fish/。我同意这确实让您很难找到所需的内容,尤其是在 GlassFish 部署指南没有明确说明的情况下。事实上,GlassFish 5 文档的很大一部分似乎与 3.1.2 没有变化,因此您可能离当前的答案不远了。
对于所有可以想象的实现对("What's the difference between Tomcat and GlassFish"、"What's the difference between GlassFish and JBoss" 等),Java EE 和 Web 配置文件之间的差异有大量解释,非常清楚大部头书。 glassfish-web.xml vs sun-web.xml vs web.xml as well as The difference between web.xml, beans.xml, applicationContext.xml, etc 有很好的问题,但它们都 link 到 GlassFish 3.x 文档[1]。
我想就
发表一些明确的声明glassfish-application.xml
和glassfish-web.xml
之间的优先级,这意味着一个优先于另一个(Web 优先于应用程序可能是合乎逻辑的,因为类加载顺序是相反的)还是从两者中选择选项?- 我可以期望提取文件的可能位置。我假设
/
在应用程序的耳朵中,/WEB-INF/
在 war (耳朵内部)中用于应用程序描述符 - 是否可以在两个文件中指定任何可以在其他文件中指定的值,例如
web.xml
或beans.xml
如果是,那么优先级是什么? - war 打包(相对于 ear 打包)Java EE 应用程序的情况如何?
我认为 Payara 和 GlassFish 之间没有区别,因为前者被设计为直接替代品 - 事实上 documentation is practically not found by google 对于 Payara 和 GlassFish 4.x 是一样的。
[1] 这是 GlassFish 的 主要问题 - 大多数时候只有 3.x 文档可以通过手册、博客中的 link 获得和 SO 问题,您必须假设它可能无法正常工作,因为某些事情从 3.x 变为 4.x,这导致 n 个问题的复杂度为 2^n。
precedence between glassfish-application.xml and glassfish-web.xml, meaning does one override the other (it could be logical that web overrides application because the classloading order is inverted) or are options picked from both?
glassfish-application.xml
适用于 .ear
个文件,而 glassfish-web.xml
适用于 .war
个文件。对于 .ear
中的 .war
,glassfish-web.xml
将覆盖 glassfish-ejb.xml
.
possible locations where I can expect the files to be picked up. I assume / in the ear for the application and /WEB-INF/ in the war (inside the ear) for the application descriptor
如果您的意思是文件应该位于何处,则 glassfish-application.xml
应该放在 .ear
的 META-INF
内,与 MANIFEST.MF
并排,而glassfish-web.xml
应放在 WEB-INF
内,与 beans.xml
.
Is it possible to specify any values in both files which can be specified in other files, like web.xml or beans.xml and if yes, what's the precedence, then?
是的,标准的 JavaEE 部署描述符,因此 web.xml
、beans.xml
等受到尊重,但是如果有特定于服务器的部署描述符(即 glassfish-web.xml
),它们将被覆盖.
What's the situation in a war packaged (as opposed to ear packaged) Java EE application?
在 war 打包的应用程序中,您应该坚持使用 glassfish-web.xml
部署描述符。这将覆盖 JavaEE web.xml
部署描述符中设置的值,但两者都将被读取。
I assume that there's no difference between Payara and GlassFish because the former is designed to be a drop-in replacement - the fact that documentation is practically not found by google is the same for Payara as for GlassFish 4.x.
由于 Payara Server 派生自 GlassFish,我们仅记录扩展或修改默认行为的区域。因此,GlassFish 4 文档 https://javaee.github.io/glassfish/documentation4 can be used for any areas not mentioned within the Payara Server documentation https://docs.payara.fish/。我同意这确实让您很难找到所需的内容,尤其是在 GlassFish 部署指南没有明确说明的情况下。事实上,GlassFish 5 文档的很大一部分似乎与 3.1.2 没有变化,因此您可能离当前的答案不远了。