title: Using GroovyPagesTemplateEngine without a request?
body: <p>I'm trying to evaluate a GSP file without a real http request. I'm trying this:</p>
  
  <pre><code>String compileGsp(File input) {
          def text = ''
          try{
              text = groovyPagesTemplateEngine.createTemplate(input).make().toString()
          }
          catch( Exception e ){
              StackTraceUtils.sanitize(e).printStackTrace()
          }
  
          return text
      }
  </code></pre>
  
  <p>but this throws an exception and yields this:</p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: 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.</p>
  </blockquote>
  
  <p>How can I evaluate GSPs without a request? If I use <code>SimpleTemplateEngine</code>, I get some functionality, but I lose all of the taglibs, which include request-void tags like <code>&lt;g:each&gt;</code></p>