When I use the following code:
CookieManager cookieManager = CookieManager.getInstance();
try {
Cookie cookie = new Cookie("JSESSIONID", jsessionId);
cookie.setExpireDate(new Date(System.currentTimeMillis() + 36000000));
cookieManager.setCookie(new URL("http://10.99.9.84"), cookie);
}
catch(Exception e) {
e.printStackTrace();
}
navigate(url);
The cookie JSESSIONID is sent to my server and my application works properly.
I delete the next line (I want a session cookie):
cookie.setExpireDate(new Date(System.currentTimeMillis() + 36000000));
but then the cookie is not sent to my server and my application stops working.
According to the documentation: "The session cookies do not have an an expiration date and created in the same process".
What am I doing wrong?
Hi David,
Thanks for reporting this issue. This is actually a known issue that in JExplorer 2.x the functionality that allows setting session cookies is broken. The reason of this behavior is that session cookies are available only for a process in which they were created. And since JExplorer 2.x all browser instances are running in separate native process, but the session cookies still creating in Java process. We will fix this issue in one of the next update of JExplorer (probably this month).
Regards,
Vladimir Ikryanov
Hello.
Do you have available a version of JExplorer with this resolved?.
Thank you.
Hi David,
The fix for this issue will be available next week.
Regards,
Vladimir Ikryanov
Hi Vladimir,
Just a question related to Session cookies:
From JExplorer 2.x an instance of browser has it own native process. Correct? if I have two browser controls (Say Browser A & Browser B) embedded in my application then can session cookies created by Browser A be used by Browser B as both these browsers are created using same java process? In other words, Is it possible to share the session cookies among different browser controls embedded within a java application?
Best Regards,
Niranjan Venkatachari.
Hi Niranjan,
Only Browser instances created in the same process can have access to session cookies each other.
In order to create Browser instances in the same process you can use the following code:
Browser browser1 = new Browser();
Browser browser2 = new Browser(browser1);
Regards,
Vladimir Ikryanov
Hi David,
We have fixed issue with session cookies. The updated build with the fix is available on our ftp:ftp://ftp.teamdev.com/updates/jexplorer-2.2.37.zip
The sample that demonstrates how to use this functionality you can find here: http://support.teamdev.com/docs/DOC-1142
Regards,
Vladimir Ikryanov
Hello.
I'm using the version 2.3 of Jexplorer. With Explorer 6 works correctly.
With explorer 7 I am still forced to put a expire date of the cookie to be sent.
Hi David,
Thanks for reporting this issue. I have added this bug request on the next JExplorer 2.4 version.
Regards,
Vladimir Ikryanov