Code example for UrlEncodedFormEntity

Methods: setContentEncodingsetContentType

0
	   public HttpResponse initAction(List<NameValuePair> pairslist,Links link){
	           
	          HttpPost httppost = new HttpPost(link.toString());
	          Log.d("lbs","http post constructed");
	          try { 
	              UrlEncodedFormEntity form = new UrlEncodedFormEntity(pairslist,HTTP.UTF_8);
	              //UrlEncodedFormEntity form = new UrlEncodedFormEntity() 
	              form.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
	              form.setContentEncoding("UTF-8");
	              //httppost.setEntity(new StringEntity("","UTF-8")); 
	               
	              HttpResponse response = httpclient.execute(httppost);
	              return response;
	          } catch (UnsupportedEncodingException e) {
	              // TODO Auto-generated catch block 
	              e.printStackTrace();
	          } catch (ClientProtocolException e) {
	              // TODO Auto-generated catch block 
	              e.printStackTrace();
	          } catch (IOException e) {
Experience pair programming with AI  Get Codota for Java