rob345
rob345

Reputation: 203

cookie persistence with DefaultHttpClient and Swingworker

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 session)? 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

Upvotes: 1

Views: 280

Answers (1)

trashgod
trashgod

Reputation: 205875

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.

Upvotes: 1

Related Questions