title: Grails, how to get the request object
body: <p>Grails has a request object which is defined <a href="http://grails.org/doc/2.2.1/ref/Servlet%20API/request.html" rel="noreferrer">here</a>.</p>
  
  <p>The problem is when I try to use it, I get: </p>
  
  <pre><code>No such property: request for class:xxx
  </code></pre>
  
  <p>Reading the first 100 hits googling this error only produced one suggestion:</p>
  
  <pre><code>import javax.servlet.http.HttpServletRequest
  import org.springframework.web.context.request.ServletRequestAttributes
  :
  def my() {
      HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
  }
  </code></pre>
  
  <p>However, this gives:</p>
  
  <pre><code>groovy.lang.MissingPropertyException: No such property: RequestContextHolder for class: net.ohds.ReportService
  </code></pre>
  
  <ol>
  <li>How does one get a handle on the request object in Grails?</li>
  <li>How do you find out about this?  So few people have asked this question, it must be documented somewhere, or in some example, but I can't find either.</li>
  </ol>