I’m using Grails 2.0.0, and trying to prepopulate some test data from Bootstrap.groovy. This data requires createLinkTo from Grails taglib.
Btw, when i’m trying to call g.createLinkTo(...) I getting:
Message: No thread-bound request found: Are you referring to request attributes outside
of an actual web request, or processing a request outside of the originally receiving
thread? If you are actually operating within a web request and still receive this message,
your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this
case, use RequestContextListener or RequestContextFilter to expose the current request.
And also, this app is going to use createLinkTo in background threads (event processing, send mails, etc). So I need it not only in Bootstrap.
As I understand I need to make an mock request, and bind it to current thread, but how I can do that?
Or maybe there is another way to make app links?
In grails 2 you can use the
LinkGeneratorHave a look here in the Link Generation API section.