我的baseUrl是http://localhost:8080/whatever
。在其他機器上,它是http://localhost/whatever
。Grails智能地獲得戰爭baseUrl?
有一個聰明的方式來獲取這些信息,而無需使用
<%
String baseUrl = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()
%>
我想動態創建一些鏈接路徑參數休息網址,即:
http://localhost:8080/a/b/${param1}/c/${param2}
如果有一個更好的方式來做到這一點,讓我知道。
你沒有遺漏任何東西。我知道這條道路必須在某種配置中存在。我完全錯過了Config.groovy中的這個 – 2011-03-16 13:14:26