Code example for StringEntity

Methods: setContentType

0
			return executeRequest(request);
		} 
		 
		private HttpResult httpPost() throws IOException, URISyntaxException { 
			HttpPost request = new HttpPost(url_str);
			StringEntity entity = new StringEntity(vars, HTTP.UTF_8);
			entity.setContentType("application/x-www-form-urlencoded");
			request.setEntity ( entity );
			return executeRequest(request);
		} 
		 
		private HttpResult httpPut() throws IOException, URISyntaxException { 
			HttpPut request = new HttpPut(url_str);
			request.setEntity ( new StringEntity (vars, HTTP.UTF_8));
			return executeRequest(request);
		} 
		 
		private HttpResult executeRequest(HttpUriRequest request) throws IOException {
			 
			// this is giving me org.apache.http.client.ClientProtocolException 
			// so that's why is commented