문제

Is it possible to save the cookies to a text file and use them in later requests?
Or can we define a text file as CookieStore?

Is there some good explained example?
How long are the cookies saved in programs normally and where? In the memory and for how long? Just for the time the program runs in the VM?

Do we have to fetch each cookie from the local CookieStore iterating through the list and add them manually to the text file and add these cookies later to the CookieStore again?

도움이 되었습니까?

해결책

BasicCookieStore class shipped with HttpClient is Serializable, so its instances could be written to and read from an object stream. If you want a more elegant persistence mechanism, you will have to implement it by fetching individual cookies from the store and writing them to a persistent store.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top