在grails框架中的Quartz-Job中使用createLink()方法?
我想在 grails 中的 Quartz-Job 中创建一个链接,如下所示:
createLink(controller:"auto", action:"show", id: auto.id);
但在运行时我只收到如下异常
org.quartz.JobExecutionException:没有方法签名:packagename.RefreshStatsJob.createLink() 适用于参数类型:(java.util.LinkedHashMap) 值:[[controller:auto, action:show, id:1] ]
应该如何我在这个类中创建链接?我需要导入哪个包?
I want to create a Link in my Quartz-Job in grails like this:
createLink(controller:"auto", action:"show", id: auto.id);
But at runtime I'm only getting exceptions like
org.quartz.JobExecutionException: No signature of method: packagename.RefreshStatsJob.createLink() is applicable for argument types: (java.util.LinkedHashMap) values: [[controller:auto, action:show, id:1]]
How should I create links in this class? Which package do I need to import?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑到您正在尝试从 Quartz 作业而不是有权访问请求的东西,看起来使用 createLink() 是行不通的。 (或者最好与一些黑客一起工作。)有一个关于此的 Grails 缺陷:
http:// /jira.grails.org/browse/GRAILS-2605
也就是说,在新的 Grails 1.4 中,LinkGenerator 看起来可以满足您的需求。
http://grails.org /doc/1.4.x/api/org/codehaus/groovy/grails/web/mapping/LinkGenerator.html
Given that you are trying to it from a Quartz job and not something that has access to a request it looks like using createLink() isn't going to work. (Or at best work with some hackery.) There is a Grails defect written up about this:
http://jira.grails.org/browse/GRAILS-2605
That being said, with the new Grails 1.4 it looks like LinkGenerator will do what you are looking for.
http://grails.org/doc/1.4.x/api/org/codehaus/groovy/grails/web/mapping/LinkGenerator.html