Play フレームワークの構成ファイルで「war.context」を使用する方法は?
4089 次
1 に答える
4
あなたが求めていることの説明については、Google グループのこのスレッドをご覧ください。
http://groups.google.com/group/play-framework/browse_thread/thread/b4783c821fd29898?pli=1
本質的に、それが言っていることは、です。
application.conf ファイルで、次のようなプロパティを設定します。
war.context=/MyAppName
次に、ルート ファイルで、次の方法で WAR コンテキストを含めるように設定します。
# Set context name
%{ ctx = play.configuration.getProperty('war.context', '') }%
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET ${ctx}/ Application.index
# Map static resources from the /app/public folder to the /public path
GET ${ctx}/public/ staticDir:public
# Catch all
* ${ctx}/{controller}/{action} {controller}.{action}
したがって、war.context に何を配置しても、ルートに配置して正しいパスを取得できることがわかります。
于 2010-12-05T10:34:37.273 に答える