本文介绍了如何使用"war.context"在Play框架的配置文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Play Framework的配置文件中使用"war.context"?
how to use "war.context" in Configuration file of Play Framework ?
推荐答案
在Google网上论坛上查看此线程,以获取对您所要询问的内容的描述.
Take a look at this thread on the Google Groups for a description of what you are asking.
http://groups.google.com/组/播放框架/浏览线程/线程/b4783c821fd29898?pli = 1
本质上说的是.
在application.conf文件中,设置一个属性,例如
In your application.conf file, you set a property such as
war.context=/MyAppName
然后,在您的路由文件中,通过以下方式将其设置为包含WAR上下文
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.
这篇关于如何使用"war.context"在Play框架的配置文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!