List of usage examples for org.apache.http.client ClientProtocolException printStackTrace
public void printStackTrace()
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.ChatterMessageImpl.java
/** * @param outMap//w w w.j av a 2 s . c om * @return */ private Map<String, String> delete(Map<String, String> outMap) { Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); TransportTools tst = new TransportTools( args.get(INSTANCE_URL) + SALESFORCECRM_CHATTER_MESSAGE_URL + args.get(ID), null, header); String responseBody = null; try { TransportMachinery.delete(tst); responseBody = DELETE_STRING + args.get(ID); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } outMap.put(OUTPUT, responseBody); return outMap; }
From source file:weavebytes.com.futureerp.activities.DashBoardActivity.java
public void JsonParsing() { new AsyncTask<Void, Void, String>() { @Override//from w w w .j av a2 s . c o m protected void onPreExecute() { super.onPreExecute(); progress.setMessage("Please Wait.."); progress.setProgressStyle(ProgressDialog.STYLE_SPINNER); progress.setCancelable(true); progress.show(); } @Override protected String doInBackground(Void... params) { if (isOnline()) { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(Config.URL + Config.U_ID); HttpResponse response = null; try { response = httpClient.execute(httpget); //Converting Response To JsonString return ConvertResponse_TO_JSON.entityToString(response.getEntity()); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return "Bad Network"; } else { return "Check Your Connection"; } } @Override protected void onPostExecute(String JasonString) { try { progress.dismiss(); try { JSONArray JArray; JArray = new JSONArray(JasonString); for (int i = 0; i < JArray.length(); i++) { JSONObject obj = JArray.optJSONObject(i); String name = obj.optString("name").toString(); arrayList.add(name); } } catch (Exception e) { e.printStackTrace(); } MyAdapter myAdapter = new MyAdapter(DashBoardActivity.this, arrayList, Config.IMG_ID); list = (ListView) (findViewById(R.id.list)); list.setAdapter(myAdapter); } catch (Exception e) { e.printStackTrace(); } } }.execute(); }
From source file:com.uzmap.pkg.uzmodules.uzBMap.methods.MapGoogleCoords.java
private void onResponse(HttpGet get) { try {//from ww w. j ava 2s.c o m HttpResponse response = mClient.execute(get); parseResp(response); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.AccountImpl.java
/** * This method updates an account in salesforce.com and returns a success message with updated account id. * This method gets input from a MAP(contains json data) and returns a MAp. * @param outMap //from w ww . j a v a 2 s . c o m */ private Map<String, String> update() { Map<String, String> outMap = new HashMap<String, String>(); final String SALESFORCE_UPDATE_ACCOUNT_URL = args.get(INSTANCE_URL) + SALESFORCE_ACCOUNT_URL + args.get(ID); Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); Map<String, Object> accountAttrMap = new HashMap<String, Object>(); accountAttrMap.put(S_NAME, args.get(NAME)); TransportTools tst = new TransportTools(SALESFORCE_UPDATE_ACCOUNT_URL, null, header); Gson obj = new GsonBuilder().setPrettyPrinting().create(); tst.setContentType(ContentType.APPLICATION_JSON, obj.toJson(accountAttrMap)); try { TransportMachinery.patch(tst).entityToString(); outMap.put(OUTPUT, UPDATE_STRING + args.get(ID)); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return outMap; }
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.CaseImpl.java
/** * this method deletes an case in salesforce.com and returns a success message with deleted case id. * This method gets input from a MAP(contains json data) and returns a MAp. * @param outMap //from www .j av a 2 s.c o m */ private Map<String, String> delete() { Map<String, String> outMap = new HashMap<>(); final String SALESFORCE_DELETE_CASE_URL = args.get(INSTANCE_URL) + SALESFORCE_CASE_URL + args.get(ID); Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); TransportTools tst = new TransportTools(SALESFORCE_DELETE_CASE_URL, null, header); try { TransportMachinery.delete(tst); outMap.put(OUTPUT, DELETE_STRING + args.get(ID)); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return outMap; }
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.ContactImpl.java
/** * this method deletes an contact in salesforce.com and returns a success message with deleted contact id. * This method gets input from a MAP(contains json data) and returns a MAp. * @param outMap //from w ww. jav a2s. c om */ private Map<String, String> delete() { Map<String, String> outMap = new HashMap<>(); final String SALESFORCE_DELETE_CONTACT_URL = args.get(INSTANCE_URL) + SALESFORCE_CONTACT_URL + args.get(ID); Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); TransportTools tst = new TransportTools(SALESFORCE_DELETE_CONTACT_URL, null, header); try { TransportMachinery.delete(tst); outMap.put(OUTPUT, DELETE_STRING + args.get(ID)); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return outMap; }
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.LeadsImpl.java
/** * this method lists all lead in salesforce.com and returns a list of all lead details. * This method gets input from a MAP(contains json data) and returns a MAp. * @param outMap /*from ww w . jav a 2 s . co m*/ */ private Map<String, String> list() { Map<String, String> outMap = new HashMap<>(); final String SALESFORCE_LIST_LEAD_URL = args.get(INSTANCE_URL) + "/services/data/v25.0/query/?q=SELECT+Company,Id,LastName+FROM+Lead"; Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); TransportTools tst = new TransportTools(SALESFORCE_LIST_LEAD_URL, null, header); try { String responseBody = TransportMachinery.get(tst).entityToString(); outMap.put(OUTPUT, responseBody); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } return outMap; }
From source file:it.openyoureyes.test.panoramio.Panoramio.java
public List<GeoItem> examinePanoramio(Location current, double distance, Drawable myImage, Intent intent) { ArrayList<GeoItem> result = new ArrayList<GeoItem>(); /*//from ww w. j av a 2 s.c o m * var requiero_fotos = new Json.Remote( * "http://www.panoramio.com/map/get_panoramas.php?order=popularity& * set= * full&from=0&to=10&minx=-5.8&miny=42.59&maxx=-5.5&maxy=42.65&size= * medium " */ Location loc1 = new Location("test"); Location loc2 = new Location("test_"); AbstractGeoItem.calcDestination(current.getLatitude(), current.getLongitude(), 225, distance / 2, loc1); AbstractGeoItem.calcDestination(current.getLatitude(), current.getLongitude(), 45, distance / 2, loc2); try { URL url = new URL( "http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=full&from=0&to=10&minx=" + loc1.getLongitude() + "&miny=" + loc1.getLatitude() + "&maxx=" + loc2.getLongitude() + "&maxy=" + loc2.getLatitude() + "&size=thumbnail"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuffer buf = new StringBuffer(); while ((line = reader.readLine()) != null) { buf.append(line + " "); } reader.close(); is.close(); conn.disconnect(); // while (is.read(buffer) != -1); String jsontext = buf.toString(); Log.d("Json Panoramio", jsontext); JSONObject entrie = new JSONObject(jsontext); JSONArray arr = entrie.getJSONArray("photos"); for (int i = 0; i < arr.length(); i++) { JSONObject panoramioObj = arr.getJSONObject(i); double longitude = panoramioObj.getDouble("longitude"); double latitude = panoramioObj.getDouble("latitude"); String urlFoto = panoramioObj.getString("photo_file_url"); String idFoto = panoramioObj.getString("photo_id"); Bundle bu = intent.getExtras(); if (bu == null) bu = new Bundle(); bu.putString("id", idFoto); intent.replaceExtras(bu); BitmapDrawable bb = new BitmapDrawable(downloadFile(urlFoto)); PanoramioItem item = new PanoramioItem(latitude, longitude, false, bb, intent); result.add(item); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return result; }
From source file:org.megam.deccanplato.provider.salesforce.crm.handler.PartnerImpl.java
/** * this method lists all account in salesforce.com and returns a list of all account details. * This method gets input from a MAP(contains json data) and returns a MAp. * @param outMap // w ww. j a v a2 s . c o m */ private Map<String, String> list() { Map<String, String> outMap = new HashMap<>(); final String SALESFORCE_LIST_PARTNER_URL = args.get(INSTANCE_URL) + "/services/data/v25.0/query/?q=SELECT+Role,Id+FROM+Partner"; Map<String, String> header = new HashMap<String, String>(); header.put(S_AUTHORIZATION, S_OAUTH + args.get(ACCESS_TOKEN)); TransportTools tst = new TransportTools(SALESFORCE_LIST_PARTNER_URL, null, header); try { String responseBody = TransportMachinery.get(tst).entityToString(); outMap.put(OUTPUT, responseBody); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } return outMap; }