Code example for HttpPost

Methods: setParams

0
	public JSONArray callSimpleArray() throws URISyntaxException,
			JSONRPCException { 
 
		URI uri = new URI(serviceUri);
 
		HttpPost request = new HttpPost(uri);
 
		HttpParams params = new BasicHttpParams();
		HttpConnectionParams.setConnectionTimeout(params, connectionTimeout);
		HttpConnectionParams.setSoTimeout(params, soTimeout);
		HttpProtocolParams.setVersion(params, PROTOCOL_VERSION);
		request.setParams(params);
		long start = System.currentTimeMillis();
		try { 
			// Execute the request and try to decode the JSON Response 
 
			HttpResponse response = httpClient.execute(request);
			long duration = System.currentTimeMillis() - start;
			// Log.i(TAG, "Request Time (in millis): " + duration); 
			String responseString = EntityUtils.toString(response.getEntity());
			responseString = responseString.trim();
			return new JSONArray(responseString);