Code example for BasicResponseHandler

Methods: handleResponse

1
	// ------------------------------ 
	public String sendHttpPostRequest(String httpUrl, ArrayList<NameValuePair> httpData) {
		// Create a new HttpClient and Post Header 
	    HttpPost httppost = new HttpPost(httpUrl);
	    HttpResponse response = null;
	    BasicResponseHandler basicResponseHandler = new BasicResponseHandler();
	    String endResult = "";
	    try { 
	    	// Add data 
	        httppost.setEntity(new UrlEncodedFormEntity(httpData));
	        // Execute HTTP Post Request 
	        response = httpClient.execute(httppost);
	        endResult  = basicResponseHandler.handleResponse(response);
	    } catch (ClientProtocolException e) { e.printStackTrace(); } 
	    catch (IOException e) { e.printStackTrace(); }
	    return endResult;
	} 
	 
	/* 
	 * after invoke this method, session should be kept 
Stop searching for code, let great code find you!  Add Codota to your java IDE