我正在使用apache DefaultHttpClient
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpGetRequest = new HttpGet(Constants.GET_ADDRESS_2_LETTERS_URL + params[0]);
StringEntity se;
httpGetRequest.addHeader("Authorization", SharedPrefsSingleton.getInstance().getSharedPrefs().getString(Constants.USER_AUTHORIZATION, null));
httpGetRequest.addHeader("Content-Type", "application/json");
httpGetRequest.addHeader("Accept", "application/json; charset=utf-8");
HttpResponse response = (HttpResponse) httpclient.execute(httpGetRequest);
有时我会在org.apache.http.client.ClientProtocolException
行
HttpResponse response = (HttpResponse) httpclient.execute(httpGetRequest);
我的Authorization
标题:
public String getBase64(String str)
{
return Base64.encodeToString(str.getBytes(), Base64.NO_WRAP);
}
其他一切都很常见。问题有时会发生,而不是平常。
这可能是什么原因?