Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Retain cookies for httpclient?

Retain cookies for httpclient?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Retain cookies for httpclient?

Postby mardah » Mon Nov 30, 2009 9:51 am

Hi

I'm using httpclient to get data from a server which sets a cookie. The cookie is stored in a CookieStore specified by me in the http context. If I have a global CookieStore I can retain the cookies as long as my application/process is running.

How do I retain cookies for a longer period of time? I can't find any methods that allows me to save the CookieStore to the filesystem. I have searched a lot but didn't find a solution.

Please help

BR
Martin
mardah
Freshman
Freshman
 
Posts: 3
Joined: Fri Nov 13, 2009 1:04 pm

Top

Postby Romeo Ordos » Tue Dec 08, 2009 10:13 am

Joining to topic.

You can save cookies to SharedPrefernces as strings. And restore them after app restart or whenever you want.

UPD:

To add your cookies to httpclient you need to create new Cookie:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. BasicClientCookie c = new BasicClientCookie("name", "value");
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


And add to your HttpClient:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ((AbstractHttpClient)client).getCookieStore().addCookie(c);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


That's all!
Romeo Ordos
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Aug 06, 2009 6:30 pm
Location: Donetsk, Ukraine

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 3 guests