17.9. デフォルトの Welcome Web アプリケーションの設定
JBoss EAP には、デフォルトではポート 8080 のルートコンテキストで表示されるデフォルトの Welcome アプリケーションが含まれます。
Undertow には、Welcome コンテンツに対応するデフォルトのサーバーが事前設定されています。
デフォルトの Undertow サブシステムの設定
<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
...
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker security-realm="ApplicationRealm"/>
</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=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
default-web-module の変更
デプロイされた Web アプリケーションをサーバーのルートにマップします。
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module,value=hello.war)
変更を反映するためにサーバーをリロードします。
reload
デフォルトの Welcome Web アプリケーションの無効化
default-hostのlocationエントリー (/) を削除して welcome アプリケーションを無効にします。/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
変更を反映するためにサーバーをリロードします。
reload