Search code examples
javacookiesbrowserswtjetty-httpclient

How set the same CookieStore for SWT browser and Jetty HttpClient


Since a java.net.CookieStore manages cookies in org.eclipse.jetty.client.HttpClient, I want to share the cookies with the SWT Browser widget.

HttpClient and Browser are both Eclipse technologies. Is there a way to have the same cookie store?


Solution

  • No, you cannot share the Cookie stores of HttpClient and SWT Browser. The Browser control uses the cookie store of the underlying native Browser, e.g. Mozilla, WebKit of IE.

    You may want to try Browser::setCookie() and getCookie() to store and retrieve specific SWT cookies. The changes apply to all Browser control instances within an SWT application.