[英]Can you set init parameters in the jetty-env.xml for the web app context?
I am using the maven eclipse plugin for jetty. 我正在使用码头Maven Eclipse插件。
Is it possible to set the following init param through the jetty-env.xml using the <set>
tag? 是否可以使用<set>
标签通过jetty-env.xml设置以下初始化参数?
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value>
</init-param>
I don't want to create my own web app context(webdefault.xml) 我不想创建自己的Web应用程序上下文(webdefault.xml)
Found a solution. 找到了解决方案。 You can use the <Call>
tag to invoke the setInitParameter method of the WebAppContext to set init parameters. 您可以使用<Call>
标记来调用WebAppContext的setInitParameter方法来设置初始化参数。 For this tag you set the name
attribute to the method you are calling and the first arg is the param name the second arg is the param value. 对于此标记,可以将name
属性设置为要调用的方法,第一个arg是参数名称,第二个arg是参数值。
<Call name="setInitParameter">
<Arg>org.eclipse.jetty.servlet.Default.useFileMappedBuffer</Arg>
<Arg>false</Arg>
</Call>
No, as that's a init-param
configuration for the DefaultServlet
, which is defined as a defaultDescriptor
in the WebAppContext
. 不,因为这是DefaultServlet
的init-param
配置,该配置在WebAppContext
定义为defaultDescriptor
。
By the time the jetty-env.xml
has been loaded and is being processed, the WebAppContext
instance exists, and the defaultDescriptor
has already been loaded and initialized. 到jetty-env.xml
已加载并正在处理时, WebAppContext
实例已存在,并且defaultDescriptor
已加载和初始化。
The only place you can specify that particular init-param
is in a custom defaultDescriptor
that you reference in your XML deployable for your webapp. 您唯一可以指定特定init-param
是在可为Web应用程序部署的XML中引用的自定义defaultDescriptor
中。
Note:
jetty-env.xml
exists to define various JDNI environment bound objects, its not designed for anything else really. 注意:jetty-env.xml
存在是为了定义各种JDNI环境绑定的对象,它并不是为其他目的而设计的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.