當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultHttpClient.setCookieStore方法代碼示例

本文整理匯總了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);
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:19,代碼來源:FlowzrSyncEngine.java

示例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;
}
 
開發者ID:SAP,項目名稱:devops-cm-client,代碼行數:13,代碼來源:CMOdataHTTPFactory.java


注:本文中的org.apache.http.impl.client.DefaultHttpClient.setCookieStore方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。