This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
9 Replies Last post: Feb 9, 2010 11:29 AM by David Bustos  
David Bustos   22 posts since
Apr 24, 2006
Currently Being Moderated

Oct 14, 2009 2:06 PM

How to create session cookies?

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?

Vladimir Ikryanov TeamDev Ltd. 1,013 posts since
Apr 24, 2006
Currently Being Moderated
1. Oct 14, 2009 3:06 PM in response to: David Bustos
Re: How to create session cookies?

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

Vladimir Ikryanov TeamDev Ltd. 1,013 posts since
Apr 24, 2006
Currently Being Moderated
3. Nov 18, 2009 6:43 PM in response to: David Bustos
Re: How to create session cookies?

Hi David,


The fix for this issue will be available next week.


Regards,

Vladimir Ikryanov

Niranjan Venkatachari   35 posts since
Jan 6, 2009
Currently Being Moderated
4. Nov 24, 2009 5:19 AM in response to: Vladimir Ikryanov
Re: How to create session cookies?

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.

Vladimir Ikryanov TeamDev Ltd. 1,013 posts since
Apr 24, 2006
Currently Being Moderated
5. Nov 24, 2009 1:51 PM in response to: Niranjan Venkatachari
Re: How to create session cookies?

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

Vladimir Ikryanov TeamDev Ltd. 1,013 posts since
Apr 24, 2006
Currently Being Moderated
6. Nov 26, 2009 3:52 PM in response to: David Bustos
Re: How to create session cookies?

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

Vladimir Ikryanov TeamDev Ltd. 1,013 posts since
Apr 24, 2006
Currently Being Moderated
8. Feb 8, 2010 4:46 PM in response to: David Bustos
Re: How to create session cookies?

Hi David,


Thanks for reporting this issue. I have added this bug request on the next JExplorer 2.4 version.


Regards,

Vladimir Ikryanov

More Like This

  • Retrieving data ...