如何使用“war.context"在 Play Framework 的配置文件中? [英] how to use "war.context" in Configuration file of Play Framework ?

查看:18
本文介绍了如何使用“war.context"在 Play Framework 的配置文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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/group/play-framework/browse_thread/thread/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} 

因此,您可以看到,无论您在 war.context 中放置什么,您都可以将其放入路线以选择正确的路径.

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 Framework 的配置文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆