15.4. 配置处理程序
JBoss EAP 允许您配置两种类型的处理程序:
- 文件处理程序
- reverse-Proxy 处理程序
文件处理程序 提供静态文件。每一文件处理程序必须关联到虚拟主机中的位置。reverse-proxy 处理程序 允许 JBoss EAP 充当高性能反向代理。
15.4.1. 用于配置处理程序的默认 undertow 子系统配置 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
JBoss EAP 默认提供文件处理程序。此参考提供了用于处理程序的 Undertow 子系统的默认配置。
15.4.2. 使用管理 CLI 管理文件处理程序 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
此流程解释了如何使用管理 CLI 管理 Undertow 子系统中的文件处理程序。您可以根据需要更新现有文件处理程序、创建新处理程序或删除文件处理程序。
先决条件
- 您可以访问管理 CLI。
- 有修改服务器配置的权限。
流程
更新现有文件处理程序
- 连接到管理 CLI。
运行以下命令以更新文件处理器的属性:
---- /subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=case-sensitive,value=true) ----
---- /subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=case-sensitive,value=true) ----Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重新载入服务器以应用更改:
---- reload ----
---- reload ----Copy to Clipboard Copied! Toggle word wrap Toggle overflow
创建新文件处理程序
- 连接到管理 CLI。
运行以下命令以创建新文件处理器:
---- /subsystem=undertow/configuration=handler/file=new-file-handler:add(path="${jboss.home.dir}/welcome-content") -------- /subsystem=undertow/configuration=handler/file=new-file-handler:add(path="${jboss.home.dir}/welcome-content") ----Copy to Clipboard Copied! Toggle word wrap Toggle overflow [WARNING] ==== If you set a file handler's `path` directly to a file instead of a directory, any `location` elements that reference that file handler must not end with a forward slash (`/`). Otherwise, the server will return a `404 - Not Found` response. ====
[WARNING] ==== If you set a file handler's `path` directly to a file instead of a directory, any `location` elements that reference that file handler must not end with a forward slash (`/`). Otherwise, the server will return a `404 - Not Found` response. ====Copy to Clipboard Copied! Toggle word wrap Toggle overflow
删除文件处理程序
- 连接到管理 CLI。
运行以下命令以删除文件处理程序:
---- /subsystem=undertow/configuration=handler/file=new-file-handler:remove ----
---- /subsystem=undertow/configuration=handler/file=new-file-handler:remove ----Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重新载入服务器以应用更改:
---- reload ----
---- reload ----Copy to Clipboard Copied! Toggle word wrap Toggle overflow