开发者

cookie persistence with DefaultHttpClient and Swingworker

开发者 https://www.devze.com 2023-01-23 15:51 出处:网络
I have a swingworker class calling a method that uses DefaultHttpClient to establish a persistent connection to a secure web site.After I login and make a request to the site with an instance of swing

I have a swingworker class calling a method that uses DefaultHttpClient to establish a persistent connection to a secure web site. After I login and make a request to the site with an instance of swingworker, the instance of swingworker closes (as is normal). My question is: how do I maintain the persistent login to the site so I can make a future request with another instance of swingworker - without logging into the site again (I have created a s开发者_如何学Cession)? I cannot pass an instance of DefaultHttpClient to the swingworker class (at least I don't know how). I have considered saving the cookie data to a file and then passing it the the DefaultHttpClient... but am I missing something more fundamental?

Thanks, Rob


You can pass any parameter you want to the constructor of your SwingWorker subclass, as suggested in this example, and you can do so with each invocation.

0

精彩评论

暂无评论...
验证码 换一张
取 消