I want to read JSESSIONID
from cookie org.eclipse.swt.browser.Browser
. I try to open browser from Eclipse plug-in.
I am using below snippet
public static void main(String[] args)
{
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("StackOverflow");
shell.setLayout(new FillLayout());
final Browser browser = new Browser(shell, SWT.NONE);
final String url = "https://....";
browser.setUrl(url);
browser.addProgressListener(new ProgressAdapter() {
@Override
public void completed(ProgressEvent event) {
String cookieText = "cookie=" + Browser.getCookie("JSESSIONID", url);
System.out.println(cookieText);
}
});
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}
But I am not getting cookie value.
Something like this : c# Get httponly cookie
http://stackoverflow.com/
. Before that I used Chromes inspector to see what cookies are actually sent (5 all in all). But apparently SWT cannot see all of them. The one that could not be found is namedprov
and expires in 2055. The ones that can be seen expire in 2018 latest. Maybe there is an analogy to your JSESSIONID? – Huckster