0
我的Grails 3.2.3应用程序在端口9000上运行,我正在做一个GET
请求到URL /api/mail/getUnreadCount
, m得到一个404错误的URL。
我URLMapping.groovy
有:
get "/api/$controller(.$format)?"(action: "index")
get "/api/$controller/$id(.$format)?"(action: "show")
"/api/$controller/$action?/$id?(.$format)?" {
constraints {
// apply constraints here
}
}
而且帮助我,怎样才能让Grails的URL映射日志?
更新1
class MailController {
static allowedMethods = [index: "GET", getUnreadCount: "GET"]
.....
.......
def getUnreadCount() {
User currentUserInstance = springSecurityService.getCurrentUser()
List counts = userService.getUnreadCounts(currentUserInstance)
respond(counts)
}
}
是否尝试添加'/'到'/ api/mail/getUnreadCount',因此它看起来像'/ api/mail/getUnreadCount /' – mic4ael
是的,我试过了,但仍然存在问题 –
我认为问题在于Grails应用程序在9000端口上运行不正常。请检查您是否可以通过点击** http:// localhost:9000 **来打开grails主页。如果它正在工作,那么它是否显示你的**邮件**控制器? –