title: Catch session timeout Symfony2
body: <p>I have a question about Symfony2 and I hope someone can help me out.
  Where does Symfony checks the users session and what to do is there is no session. Like redirect to the login page.</p>
  
  <p>I found some similar question, but not really what I mean.</p>
  
  <p>Why do I want to know it? If there is a session timeout. I want to check if the call is a XmlHttpRequest. If so, I want to return a JSON so the javascript can handle it. If notn do it the normal way.</p>
  
  <p>Thanks! </p>