grails - 用于组的 Grails Urlmapping 404
问题描述
我用组在 grails 中组织了我的 url 映射。
来自 UrlMappings 的示例:
class UrlMappings {
static mappings = {
group "/rest", {
"/" {
controller = "rest"
action = "index"
}
"/method1" {
controller = "rest"
action = "method1"
}
}
"/webservice/" {
controller = "webservice"
action = "index"
}
}
我想要什么:当 URL 被称为 /rest/notexists 时,我想要这个路径的 404。但仅适用于 /rest 组,因此 404 应该属于组 rest。其他 404 由我的骨干路由器处理。
有任何想法吗?
解决方案
我在其余组的末尾全部解决了这个问题:
"/**" {
controller = "rest"
action ="notFound"
}
推荐阅读
- python - 如何同时使用 substrin 和 instr pyspark
- mongodb - MongoDB 聚合性能改进
- xslt - 删除节点中第二个分隔符之前的字符串
- python - Python 中如何声明数组类型提示?
- javascript - Javascript 在初始化步骤中声明变量
- python - 有人可以给出这个函数应该做什么的示例解决方案吗?
- java - Java SSL 问题 - 无法解析的 CRLDistributionPoints 扩展
- python-3.x - TypeError:传递给“Pack”操作的“值”的列表中的张量具有不完全匹配的类型 [string, float32]。CSV 教程中的错误
- mongodb - mongodb比较两个数组并返回差异
- azure-sql-database - 满足特定条件时如何从 azure sql 发送电子邮件