Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
747 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...