title: Prevent method in Grails Controller from being exposed as action
body: <p>I am currently reading through and working the examples in <a href="http://www.infoq.com/minibooks/grails-getting-started" rel="noreferrer">Getting Started with Grails, Second Edition by Scott Davis &amp; Jason Rudolph</a>.  </p>
  
  <p>This book was written using Grails 1.2.  </p>
  
  <p>They have a code sample where they create a <code>debug()</code> method that is called by <code>beforeInterceptor</code> and explained that since <code>debug()</code> is a method, it is not exposed out to the user via URL.  They explain that Closures are exposed as Controller Actions to the End User, but methods are not.  </p>
  
  <p>I also saw on the <a href="http://grails.org/doc/1.3.7/ref/Controllers/beforeInterceptor.html" rel="noreferrer">Grails 1.3 documentation</a>, they allude to a regular method:</p>
  
  <pre><code>def auth() { ... } 
  </code></pre>
  
  <p>being treated as private because it is a method, not a closure.  Which was true as of Grails 1.3.</p>
  
  <p>However, as of Grails 2.0.0, <a href="http://grails.org/doc/2.0.0.RC1/guide/introduction.html#webFeatures" rel="noreferrer">Controller Actions can be implemented as both methods and closures</a>.</p>
  
  <p>This led me to wonder (and try to figure out) a way to replicate the functionality that is available in pre-Grails 2.0.0 of creating a method in a Controller that does not get exposed out to the end user.  </p>
  
  <p>I thought of 2 possible approaches and was wondering which would be better style / practice and why?</p>
  
  <ol>
  <li>Setting accessor as private, i.e. <code>private def auth()</code></li>
  <li><p>Setting allowedMethods for the method to empty string:</p>
  
  <pre><code>static allowedMethods = [save: "POST", update: "POST", delete: "POST", auth: ""]
  </code></pre></li>
  </ol>
  
  <p>both approaches seemed to accomplish the desired effect.  However, the first approach one gives a HTTP Error Code 404, and the second approach gives a HTTP Error Code 405.  </p>
  
  <p>Does anyone know which approach would be preferable?  Also, are there any other approaches, or a "best practices technique" for doing so?  </p>