title: Resolving Coldfusion J2EE sessions with ajax calls to cfc methods using verifyclient
body: <p>I am currently utilizing CF session management and have been investigating transitioning to utilizing J2EE session management. In my attempts to do so, ajax requests made ( when CFsession management is set to use J2EE sessions ) to CF cfc remote methods fail the verifyclient authorization. The code below works when session management uses CF session management.</p>
  
  <p>My assumption is that the _cf_clientid is no longer the correct value to pass to the remote method - as it is generated using cfid and cftoken.</p>
  
  <p>How do I successfully implement J2EE session management and utilize remote cfc methods with verifyclient? Or can it not be done? Using CF tag cfajaxproxy is not an option.</p>
  
  <p>The example code below demonstrates how to use jQuery ajax to call a remote cfc method with verifyclient='true', even though CF documentation indicates that the use of cfajaxproxy is required. This is not the case. (Thanks to Ray Camden and DWMommy. ) This leads me to believe that there may also be a work-around to implement a similar method for verifying a client when using J2EE sessions.</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>&lt;script src="/plugins/jquery-1.7.2.min.js" type="text/javascript" language="Javascript"&gt;&lt;/script&gt;
  &lt;cfajaximport /&gt;
  &lt;script&gt;
  $(function() {
              $.ajax({
                  url: 'test.cfc',    
                  type: 'get',
                  dataType: 'json',
                  data: {
                      method: 'sayHello',
                      yourname: 'Foo'
                      ,_cf_clientid: _cf_clientid
                  },
                  success: displaySearchResults
              });
  });
  &lt;/script&gt;
  &lt;script&gt;
      function displaySearchResults(res){
          $('#searchResults').html( res );
      }
  &lt;/script&gt;
  &lt;div id="searchResults"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>test.cfc</p>
  
  <pre><code>component{
      remote any function sayHello ( string yourname = 'anonymous') 
          returnformat='JSON' verifyclient='true'{
          return 'Hello ' &amp; arguments.yourname;
      }
  }
  </code></pre>