本文整理汇总了Java中org.apache.http.impl.client.DefaultHttpClient.setCookieStore方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttpClient.setCookieStore方法的具体用法?Java DefaultHttpClient.setCookieStore怎么用?Java DefaultHttpClient.setCookieStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.impl.client.DefaultHttpClient
的用法示例。
在下文中一共展示了DefaultHttpClient.setCookieStore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requery
import org.apache.http.impl.client.DefaultHttpClient; //导入方法依赖的package包/类
public static void requery(String tableName,Class clazz,String key) throws ClientProtocolException, IOException, JSONException,Exception {
Log.i(TAG,"Got key " + key + " but couldn't find related parent tr, requerying ...");
String url=FLOWZR_API_URL + nsString + "/key/?tableName=" + DatabaseHelper.TRANSACTION_TABLE + "&key=" + key;
StringBuilder builder = new StringBuilder();
DefaultHttpClient http_client2= new DefaultHttpClient();
http_client2.setCookieStore(http_client.getCookieStore());
HttpGet httpGet = new HttpGet(url);
HttpResponse httpResponse = http_client2.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
InputStream content = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
JSONObject o = new JSONObject(builder.toString()).getJSONArray(DatabaseHelper.TRANSACTION_TABLE).getJSONObject(0);
saveEntityFromJson(o, tableName, clazz,1);
}
示例2: create
import org.apache.http.impl.client.DefaultHttpClient; //导入方法依赖的package包/类
@Override
public DefaultHttpClient create(final HttpMethod method, final URI uri) {
final DefaultHttpClient httpClient = super.create(method, uri);
httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
format("SAP CM Client/%s based on %s", CMODataClient.getShortVersion(), USER_AGENT));
httpClient.setCookieStore(this.cookieStore);
return httpClient;
}