title: How to access the XmlHttpRequest object in JSF ajax's addOnEvent callback?
body: <p>I want to add a header to every AJAX request sent from every form of every page in a JSF application. In jquery I can use something like this:</p>
  
  <pre><code>$(document).ajaxSend(function(ev, xhr, opt) {
      xhr.setRequestHeader('custom-header', random-value);
  });
  </code></pre>
  
  <p>But how can I do something similar in JSF 2.2?</p>
  
  <pre><code>jsf.ajax.addOnEvent(function(data) {
      // how to access the XmlHttpRequest object?
  });
  </code></pre>