У меня есть приложение grails, над которым я работаю в своей текущей работе. Я должен работать над мобильной версией веб-сайта, и я хочу поймать в UrlMappings.groovy вопрос, поступает ли запрос с сайта www.mysite.com или m.mysite.com. Любая идея, как я могу это сделать?Как перенаправить на мобильную страницу на основе m.mysite.com в приложении grails
UPDATE:.
Мои текущие отображения выглядеть следующим образом --->
импорт статических org.apache.commons.lang.StringUtils *
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"/$lang/$controller/$action?/$id?"{
language = "${lang}"
constraints {
// apply constraints here
}
}
// Start :: Shopping Tools internal URLs
"/modelLine/build/$year/$modelLineCode/"(controller:'modelLine', action:'build')
"/colors/index"(controller:'colors', action: 'index')
"/packages/index"(controller:'packages', action: 'index')
"/accessories/index"(controller:'accessories', action: 'index')
"/summary/index"(controller:'summary', action: 'index')
// Start :: Spanish :: Shopping Tools internal URLs
"/$lang/modelLine/build/$year/$modelLineCode/"(controller:'modelLine', action:'build')
"/$lang/colors/index"(controller:'colors', action: 'index')
"/$lang/packages/index"(controller:'packages', action: 'index')
"/$lang/accessories/index"(controller:'accessories', action: 'index')
"/$lang/summary/index"(controller:'summary', action: 'index')
// End :: Spanish :: Shopping Tools internal URLs
// End :: Shopping Tools internal URLs
// Default Home Page
"/$lang?"(controller:"modelLine", action:"index"){
constraints {
lang inList:['en','fr'] // avoids invalid matching
}
}
"/admin"(controller:"admin", action:"index")
// Error page definitions
"404"(controller:"errors", action:"notFound")
"500"(controller:"errors", action:"serverError")
"403"(view:'/login/denied')
"402"(view:'/login/denied')
"401"(view:'/login/denied')
}
}
Как изменить их для обнаружения запроса m.mysite.com?
Хорошо, я отредактировал мой вопрос. Можете ли вы показать мне, как это сделать сейчас? – BrownTownCoder