开发者

how to use "war.context" in Configuration file of Play Framework ?

开发者 https://www.devze.com 2023-01-29 10:15 出处:网络
how to use开发者_Python百科 \"war.context\" in Configuration file of Play Framework ? Take a look at this thread on the Google Groups for a description of what you are asking.

how to use开发者_Python百科 "war.context" in Configuration file of Play Framework ?


Take a look at this thread on the Google Groups for a description of what you are asking.

http://groups.google.com/group/play-framework/browse_thread/thread/b4783c821fd29898?pli=1

In essence, what it is saying, is.

In your application.conf file, you set a property such as

war.context=/MyAppName

Then, in your routes file, you set it up to include your WAR context in the following way

# 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} 

You can see therefore, whatever you place in your war.context, you can then put into your routes to pick up the correct path.

0

精彩评论

暂无评论...
验证码 换一张
取 消