title: Symfony2, check if an action is called by ajax or not
body: <p>I need, for each action in my controller, check if these actions are called by an ajax request or not.</p>
  
  <p>If yes, nothing append, if no, i need to redirect to the home page.</p>
  
  <p>I have just find <code>if($this-&gt;getRequest()-&gt;isXmlHttpRequest())</code>, but i need to add this verification on each action..</p>
  
  <p>Do you know a better way ?</p>