Java Code Examples for org.apache.http.impl.client.DefaultHttpClient.setCookieStore()

The following are Jave code examples for showing how to use setCookieStore() of the org.apache.http.impl.client.DefaultHttpClient class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: financisto1-holo   File: FlowzrSyncEngine.java   View Source Code Vote up 6 votes
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);
}
 
Example 2
Project: devops-cm-client   File: CMOdataHTTPFactory.java   View Source Code Vote up 3 votes
@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;
}