如何删除(复制)X-Powered-By:JSF / 2.0 [英] How to remove (duplicate) X-Powered-By: JSF/2.0
问题描述
在我的实例中,我有
Glassfish 3.1.1 / Mojarra 2.1.3
我可以删除Glassfish管理控制台中的X-Powered-By在网络侦听器中(因此它不显示长文本:
Servlet / 3.0 JSP / 2.2(GlassFish Server开源版本3.1.1 Java / Sun Microsystems Inc. / 1.6)
但它仍然显示(是的,两次) ):
X-Powered-By:JSF / 2.0
X-Powered-By:JSF / 2.0
我使用Jersey和JAXB来公开一些Web服务,并使用@WebServlet Annotation部署一些servlet但是我认为它们不会添加任何内容。
它不是由mod_jk或Apache生成的,因为即使直接连接到应用程序端口,我也会获得这些标头(localhost:8080)
Glassfish中是否有典型的模块可以删除这些标题?
谢谢
这是由Mojarra设定的。您可以通过在webapp的<$ c $中将上下文参数 com.sun.faces.sendPoweredByHeader
设置为 false
来禁用它c> web.xml 。
< context-param>
< param-name> com.sun.faces.sendPoweredByHeader< / param-name>
< param-value> false< / param-value>
< / context-param>
然而,它发送两次值对我来说是一个谜。这不是默认行为,在技术上是不可能的(因为它表示在同一响应上构造两次 ExternalContextImpl
)。也许 mod_jk
做错了。
In my instance, I have Glassfish 3.1.1 / Mojarra 2.1.3
I could remove the X-Powered-By in Glassfish Admin Console in the Network listener (so it doesn't show the long text:
Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.1 Java/Sun Microsystems Inc./1.6)
but it still shows (yes, twice):
X-Powered-By: JSF/2.0
X-Powered-By: JSF/2.0
I am using Jersey and JAXB to expose some web-services and have some servlets deployed using the @WebServlet Annotation but I don't think they add anything.
It is not generated by mod_jk or Apache because I get those headers even when connecting to the application port directly (localhost:8080)
Is there typical modules that would do that in Glassfish? How can I remove these headers?
Thank you
It's been set by Mojarra. You can disable it by setting the context parameter com.sun.faces.sendPoweredByHeader
to false
in webapp's web.xml
.
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
However, that it sends the value twice is a mystery to me. This is not the default behaviour and technically impossible (as it would indicate the ExternalContextImpl
being constructed twice on the same response). Perhaps mod_jk
is doing something wrong.
这篇关于如何删除(复制)X-Powered-By:JSF / 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!