Search code examples
grailsgroovyquartz-schedulerjob-scheduling

Using createLink() method in Quartz-Job in grails framework?


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?


Solution

  • 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