Code example for HttpResponse

Methods: getHeaders, getStatusLine

0
		 * as redirects 
		 * @param response the http response from the server 
		 * @return true if we should redirect, false otherwise 
		 */ 
		public boolean shouldRedirect(HttpResponse response) {
			if(isRedirectResponse(response.getStatusLine().getStatusCode())) {
				// first check to make sure a valid scheme (avoid market:// urls) 
				if (response.getHeaders("Location").length == 0) return false; // not a redirect
				 
				String redirectURL = response.getHeaders("Location")[0].getValue();
				 
				if (redirectURL == null) return false;
				 
				Uri uri = Uri.parse(redirectURL);
				 
				if (uri == null 				|| 
					uri.getScheme() == null 	|| 
					uri.getPath() == null) 
								return false;