grails 0.5发布以来,
grails-xfire的WebService插件也紧跟发布,实在是好消息,可是当你兴致勃勃的去写个HelloWorld的时候,它却给你一个下马威,异常如下:
查看
mailing list好像不只我一人遇到,好像还没有解,于是根据反馈的提示,可能是
URL mapping出了问题,发现在URL mapping的文档中有解,如下:
Ignoring URLs
不过还是有个问题,就是这样修改会影响原来正常的grail的controller/action操作,目前还不知道有何好解?
我目前所知道的方法就是将每个controller映射写死在grails-app/conf/*UrlMappings.groovy中,比较笨重,但能解决问题
--补充一个比较好的解决方案:在grails-app/conf/*UrlMappings.groovy中修改mappings,如下
java 代码
- HTTP ERROR: 404
- Not Found
- RequestURI=/mytest/services/test
- Powered by Jetty://
![](http://docs.codehaus.org/images/icons/emoticons/information.gif)
Sometimes you may want to resolve URLs to servlets other than Grails. In this case, note that Grails ignores any URLs that fail to match at least one of the patterns in the mapping. So, having:
static mappings = {
"/grails/$controller/$action?/$id?" {
...
}
}
would ensure that you could, for example, use /remoting/* for a Spring invoker servlet. Beware, though, that the pattern in the default mapping captures a large range of useful URLs.
呵呵,原来官方文档已经早有解决方案,是我太固陋寡闻,借此给碰到此类问题,又不知如何解决同类中人以一些解释不过还是有个问题,就是这样修改会影响原来正常的grail的controller/action操作,目前还不知道有何好解?
我目前所知道的方法就是将每个controller映射写死在grails-app/conf/*UrlMappings.groovy中,比较笨重,但能解决问题
--补充一个比较好的解决方案:在grails-app/conf/*UrlMappings.groovy中修改mappings,如下
java 代码
- static mappings = {
- "/$controller/$action?/$id?"{
- constraints {
- controller(matches:/.*[^(services)].*/)
- }
- }
- }