Httpclient 4, error 302. How to redirect?
http://stackoverflow.com/questions/3658721/httpclient-4-error-302-how-to-redirect
1 DefaultHttpClient httpclient = new DefaultHttpClient(); 2 httpclient.setRedirectStrategy(new DefaultRedirectStrategy() { 3 public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) { 4 boolean isRedirect=false; 5 try { 6 isRedirect = super.isRedirected(request, response, context); 7 } catch (ProtocolException e) { 8 // TODO Auto-generated catch block 9 e.printStackTrace(); 10 } 11 if (!isRedirect) { 12 int responseCode = response.getStatusLine().getStatusCode(); 13 if (responseCode == 301 || responseCode == 302) { 14 return true; 15 } 16 } 17 return isRedirect; 18 } 19 });