title: Grails 2.1.1: Redirect to /index.gsp not working with Filter defined
body: <p>I have a Grails 2.1.1 application which runs fine, at least until I try to define a filter for all <code>Controller</code> to redirect to the <code>index.gsp</code> if <code>user</code> is not set in the <code>session</code> variable...</p>
  
  <p>what ever I try, I'm not able to redirect to "/index", nor render "/index" when starting the server - if I remove the filter and redirect to "/index" from my <code>AuthenticationController</code> on false parameters, all works like charm...</p>
  
  <p>so, here's what I have so far:</p>
  
  <pre><code>class AuthenticationFilters {
    all(controller:'*', action'*') {
      before = {
        def user = (User) session.getValue("user")
        if(user == null || !user.loginState) {
          redirect(controller: 'authentication', action: 'index')
          return false
        }
      }
    }
  }
  
  class AuthenticationController {
    def authenticationService
  
    def index = {
      render(view: '/index')
    }
  
    def login(LoginCommand cmd) {
      if(cmd.hasErrors()) {
        redirect(action: index)
        return
      }
    }
    ....
  }
  </code></pre>
  
  <p>now, if I comment out the <code>all</code> Filters definition, everything works well. I got the page (index.gsp) shown on start up and if the <code>LoginCommand</code> has errors, I'm redirected to the <code>index.gsp</code> page without any problems.
  if I now comment in the <code>all</code> Filters definition, I get a <code>404</code>.</p>
  
  <p>I tried:
  <a href="https://stackoverflow.com/questions/11144775/grails-redirect-to-index-gsp-that-is-not-in-any-controller">Grails: Redirect to index.gsp that is not in any controller</a>
  <a href="https://stackoverflow.com/questions/8089592/upgrade-to-grails-2-0-index-gsp-not-found">Upgrade to Grails 2.0: /index.gsp not found</a>
  <a href="https://stackoverflow.com/questions/6193390/grails-what-are-the-main-issues-and-his-solutions-when-deploying-in-weblogic">Grails: what are the main issues (and his solutions) when deploying in weblogic?</a></p>
  
  <p>but I didn't had any luck...</p>
  
  <p>I'm developing on Intellij IDEA 11.1.4 Premium (evaluation)</p>
  
  <hr>
  
  <p><strong>EDIT:</strong> I tried to get the <code>User</code> object from the <code>session</code> property in my <code>AuthenticationFilters</code> class, surrounded by a <code>try/catch</code> block and now facing the problem that obviously the <code>session</code> property is not available? why?</p>
  
  <pre><code>try {
          def user = (User) session.getValue("user")
          if((user == null || !user.loginState)) {
              ...
          }
      } catch(Exception e) {
          println("... couldn't get user from session! ${e.getMessage()}")
      }
  </code></pre>
  
  <p>console output:</p>
  
  <pre><code>... couldn't get user from session! No such property: session for class: grailstest001.AuthenticationFilters
  </code></pre>
  
  <p>any suggestions on this?</p>