17.7. デフォルトの Welcome Web アプリケーションの設定
JBoss EAP には、デフォルトではポート 8080
のルートコンテキストで表示されるデフォルトの Welcome アプリケーションが含まれます。
Undertow には、Welcome コンテンツに対応するデフォルトのサーバーが事前設定されています。
デフォルトの Undertow サブシステムの設定
<subsystem xmlns="urn:jboss:domain:undertow:3.1"> ... <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="https"/> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content"/> <filter-ref name="server-header"/> <filter-ref name="x-powered-by-header"/> </host> </server> ... <handlers> <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> </handlers> ... </subsystem>
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
...
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
...
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
...
</subsystem>
デフォルトのサーバー default-server
にはデフォルトのホスト default-host
が設定されています。デフォルトのホストは、welcome-content
ファイルハンドラーで <location>
要素を使用して、サーバーのルートへのリクエストを処理するよう設定されています。welcome-content
ハンドラーは path
プロパティーに指定された場所でコンテンツを処理します。
このデフォルトの Welcome
アプリケーションは、独自の Web アプリケーションで置き換えることができます。これは、以下の 2 つのいずれかの方法で設定できます。
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=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)
/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)
変更を反映するためにサーバーをリロードします。
reload
reload
デフォルトの Web モジュールの変更
デプロイされた Web アプリケーションをサーバーのルートにマップします。
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module,value=hello.war)
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module,value=hello.war)
変更を反映するためにサーバーをリロードします。
reload
reload
デフォルトのウェルカム Web アプリケーションの無効化
default-host
の location
エントリー (/
) を削除して welcome アプリケーションを無効にします。
/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
変更を反映するためにサーバーをリロードします。
reload
reload