17.7. 配置默认的 Welcome Web 应用程序
JBoss EAP 包含一个默认的 Welcome 应用程序,它默认显示在端口 8080 的根上下文里。
在 Undertow 里预配置了一个默认的服务器来提供欢迎内容。
默认的 Undertow 子系统配置
...
...
...
默认的服务器(default-server)配置了一个默认的主机(default-host)。这个默认的主机用 元素和 welcome-content 文件处理程序处理到服务器根目录的请求。welcome-content 处理程序在 path 属性指定的位置上提供内容。
您可以用自己的 Web 应用程序替换默认的 Welcome 应用程序。这可以用下列两种方法之一来配置:
修改 welcome-content 文件处理程序
修改现有的 welcome-content 文件处理程序的路径来指向新的部署。/subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=path,value="/path/to/content")
注意
或者,您可以创建一个服务器根目录使用的不同文件处理程序。/subsystem=undertow/configuration=handler/file=NEW_FILE_HANDLER:add(path="/path/to/content")
/subsystem=undertow/server=default-server/host=default-host/location=\/:write-attribute(name=handler,value=NEW_FILE_HANDLER)
重新载入服务器来使所做的修改生效。重新载入
修改 default-web-module
映射部署的 Web 应用程序至服务器的根目录。/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module,value=hello.war)
重新载入服务器来使所做的修改生效。重新载入
禁用默认的 Welcome Web 应用程序
通过删除 default-host 的 location 条目(/)来禁用欢迎应用程序。/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
重新载入服务器来使所做的修改生效。重新载入