Code example for BasicResponseHandler

Methods: handleResponse

0
	} 
 
	@Override 
	protected String doInBackground(Void... params) {
		HttpGet questionRequest = new HttpGet(serverUrl);
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
		/*value will be a field in this class and FetchQuestionCallback will 
		 * set the value with the session_id before calling execute 
		 * */ 
		questionRequest.setHeader("Authorization", "Tequila " + this.sessionId); 
		 
		String questionResponse = "";
		HttpResponse httpResponse = null;
		 
		try { 
			//firstQuestion = SwengHttpClientFactory.getInstance().execute(firstRandom, firstHandler); 
		/**public String handleResponse (HttpResponse response) :  
		 * Returns the response body as a String if the response was successful (a 2xx status code).  
		 * If no response body exists, this returns null. If the response was unsuccessful (>= 300 status code), 
		 * throws an HttpResponseException.  
		 */ 
			httpResponse = Proxy.getInstance().execute(questionRequest);
			questionResponse = responseHandler.handleResponse(httpResponse);
		} catch (IOException e) {
			questionResponse = null;
		} 
		if (httpResponse != null) {
			Log.e("SERVER", "Replied with status code " + httpResponse.getStatusLine().getStatusCode());
Stop searching for code, let great code find you!  Add Codota to your java IDE