Example usage for org.apache.http.client ClientProtocolException printStackTrace

List of usage examples for org.apache.http.client ClientProtocolException printStackTrace

Introduction

In this page you can find the example usage for org.apache.http.client ClientProtocolException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.megam.deccanplato.provider.salesforce.chatter.handler.FeedImpl.java

/**
 * This method shows the comment item details and comment id
 * it also shows comment count.//from   www  .j  a  v  a  2s.  c o m
 * @param outMap feed item id
 * @return
 */
private Map<String, String> comment() {
    Map<String, String> outMap = new HashMap<>();
    final String SALESFORCE_CHATTER_ACTIVITY_URL = "/services/data/v25.0/chatter/feed-items/" + args.get(ID)
            + "/comments";

    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) + SALESFORCE_CHATTER_ACTIVITY_URL, null,
            header);
    try {
        String response = TransportMachinery.get(tst).entityToString();
        outMap.put(OUTPUT, response);
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    return outMap;
}

From source file:org.megam.deccanplato.provider.salesforce.chatter.handler.FeedImpl.java

/**
 * This method shows list of feed items and access that items
 * It takes feed id as input.//from w  w  w  .j a  va2s  .  c o m
 * @param outMap
 * @return list of user feeds.
 */
private Map<String, String> list() {
    Map<String, String> outMap = new HashMap<>();
    final String SALESFORCE_CHATTER_ACTIVITY_URL = "/services/data/v25.0/chatter/feed-items/" + 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(args.get(INSTANCE_URL) + SALESFORCE_CHATTER_ACTIVITY_URL, null,
            header);

    try {
        String response = TransportMachinery.get(tst).entityToString();
        outMap.put(OUTPUT, response);
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    return outMap;
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityID(Context context, String cityId) {
    WeatherInfo model = new WeatherInfo();
    try {//  www  .j  a v  a 2 s. c  om
        Gson gson = new Gson();
        model = gson.fromJson(weatherById(context, cityId), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityLatLon(Context context, String latLon) {
    WeatherInfo model = new WeatherInfo();
    try {//from   w  w  w.j a  va2  s. com
        Gson gson = new Gson();
        model = gson.fromJson(weatherByGeoCo(context, latLon), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityName(Context context, String city, String language) {
    WeatherInfo model = new WeatherInfo();
    try {/*from  w w w.  j ava2s.  co  m*/
        Gson gson = new Gson();
        model = gson.fromJson(weatherByCityName(context, city, language), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityID(Context context, String cityId, String language) {
    WeatherInfo model = new WeatherInfo();
    try {/*from w w w  .j av a 2s . c o  m*/
        Gson gson = new Gson();
        model = gson.fromJson(weatherById(context, cityId, language), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityLatLon(Context context, String latLon, String language) {
    WeatherInfo model = new WeatherInfo();
    try {/* w w  w  .  jav a 2s  . c o  m*/
        Gson gson = new Gson();
        model = gson.fromJson(weatherByGeoCo(context, latLon, language), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:palamarchuk.fraudguide.utils.QueryMaster.java

@Override
public void run() {
    super.run();//from  www .  j  a va2  s  .co m

    if (!isNetworkConnected()) {
        handler.sendEmptyMessage(QUERY_MASTER_NETWORK_ERROR);
        return;
    }
    HttpParams httpParams = new BasicHttpParams();
    httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeoutConnection);

    DefaultHttpClient httpclient = new DefaultHttpClient(httpParams);
    //        httpclient.setParams(httpParams);

    HttpPost httpPost;
    HttpGet httpGet;

    HttpResponse response = null;

    try {

        if (queryType == QUERY_GET) {
            httpGet = new HttpGet(url);

            response = httpclient.execute(httpGet);

        } else if (queryType == QUERY_POST) {

            httpPost = new HttpPost(url);
            if (entity != null) {
                httpPost.setEntity(entity);
            }
            response = httpclient.execute(httpPost);
        }

        serverResponse = EntityUtils.toString(response.getEntity());

        handler.sendEmptyMessage(QUERY_MASTER_COMPLETE);

    } catch (ClientProtocolException e) {
        e.printStackTrace();
        handler.sendEmptyMessage(QUERY_MASTER_ERROR);
    } catch (IOException e) {
        e.printStackTrace();
        handler.sendEmptyMessage(QUERY_MASTER_ERROR);
    } catch (NullPointerException e) {
        e.printStackTrace();
        handler.sendEmptyMessage(QUERY_MASTER_ERROR);
    }
}

From source file:ali.arshad.soomro.openweathermap.androidsdk.WeatherUtil.java

public WeatherInfo getCurrentWeatherByCityName(Context context, String city) {
    WeatherInfo model = new WeatherInfo();
    try {/* ww w.j a  va 2 s.  c om*/

        Gson gson = new Gson();
        model = gson.fromJson(weatherByCityName(context, city), WeatherInfo.class);
        return model;
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.liato.bankdroid.banking.banks.Nordea.java

@Override
public void updateTransactions(Account account, Urllib urlopen) throws LoginException, BankException {
    super.updateTransactions(account, urlopen);

    //No transaction history for loans, funds and credit cards.
    int accType = account.getType();
    if (accType == Account.LOANS || accType == Account.FUNDS || accType == Account.CCARD)
        return;// ww  w  .j  a v  a 2s . c o  m

    String response = null;
    Matcher matcher;
    try {
        response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/accounts.html");
        Log.d(TAG, "Opening: https://mobil.nordea.se/banking-nordea/nordea-c3/account.html?id=konton:"
                + account.getId());
        response = urlopen.open(
                "https://mobil.nordea.se/banking-nordea/nordea-c3/account.html?id=konton:" + account.getId());
        matcher = reTransactions.matcher(response);
        ArrayList<Transaction> transactions = new ArrayList<Transaction>();
        while (matcher.find()) {
            transactions.add(new Transaction(Html.fromHtml(matcher.group(1)).toString().trim(),
                    Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3))));
        }
        account.setTransactions(transactions);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}