title: How to prevent apache http client from following a redirect
body: <p>I'm connecting to a remote server with apache http client. the remote server sends a redirect, and i want to achieve that my client isn't following the redirect automatically so that i can extract the propper header and do whatever i want with the target.</p>
  
  <p>i'm looking for a <strong>simple working code sample</strong> (copy paste) <strong>that stops the automatic redirect following behaviour</strong>.</p>
  
  <p>i found <a href="https://stackoverflow.com/questions/1352949/preventing-httpclient-4-from-following-redirect">Preventing HttpClient 4 from following redirect</a>, but it seems i'm too stupid to implement it with HttpClient 4.0 (GA) </p>