15.7. 配置处理程序
JBoss EAP 允许配置两种类型的处理程序:
- 文件处理程序
- reverse-proxy 处理程序
文件处理程序提供静态文件。每一文件处理程序必须关联到虚拟主机中的位置。reverse-proxy 处理程序允许 JBoss EAP 充当高性能 reverse-proxy。
JBoss EAP 默认提供文件处理程序:
默认的 Undertow 子系统配置
<subsystem xmlns="{UndertowSubsystemNamespace}" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other"> <buffer-cache name="default"/> <server name="default-server"> ... </server> <servlet-container name="default"> ... </servlet-container> <handlers> <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> </handlers> </subsystem>
将 WebDAV 用于静态资源
旧版 JBoss EAP 允许通过
的方式将 WebDAV 与 Web 子系统一起使用,以托管静态资源并启用额外的 HTTP 方法来访问和操作这些文件。在 JBoss EAP 8.0 中,Web
davServletundertow
子系统不提供使用文件处理程序提供静态文件的机制,但 undertow
子系统不支持 WebDAV。如果要将 WebDAV 与 JBoss EAP 8.0 搭配使用,您可以编写自定义 WebDAV servlet。
更新现有文件处理程序
更新现有的文件处理程序:
/subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=case-sensitive,value=true)
reload
创建新文件处理程序
要创建新文件处理程序,请执行以下操作:
/subsystem=undertow/configuration=handler/file=new-file-handler:add(path="${jboss.home.dir}/welcome-content")
警告
如果您将文件处理程序 的路径
直接设置为文件而不是目录,则引用该文件处理程序的任何位置元素都不能以正斜杠(/
)结尾。否则,服务器将返回
404 - Not Found
响应。
删除文件处理程序
删除文件处理程序
/subsystem=undertow/configuration=handler/file=new-file-handler:remove
reload
有关可用于配置处理程序的属性的完整列表,请参阅 Undertow 子系统属性 部分。