Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Re: Retrieve cookies from introPart
Re: Retrieve cookies from introPart [message #515553] |
Fri, 19 February 2010 06:06 |
|
Cross-post to SWT forum to increase probability of answer.
Mickael Istria a écrit :
> Hello,
>
> I need to retrieve a cookie from a Web navigation in the intro part.
> Indeed, the intro part contains a link to an external URL, user can
> browse the site with it, and the site sets a cookue. I need this cookie
> in an IIntroAction that can be started when clicking a link.
>
> I found the Browser.getCookie("cookieId", "http://www.bonitasoft.org")
> would do the trick, however this always return me null...
>
> Does anyone have an advice, a snippet or an idea for me, please?
>
> Regards,
> --
> Mickael Istria - BonitaSoft S.A.
> http://www.bonitasoft.com/products/downloads.php
|
|
| |
Re: Retrieve cookies from introPart [message #515670 is a reply to message #515620] |
Fri, 19 February 2010 17:20 |
|
Hello Grant,
Yes, our app starts a brower from time to time. We don't force it to use style SWT.MOZILLA, but since I run on Linux, it is probably implicit. For example, I imagine that, on Linux, the introPart opens a browser with such style, doesn't it?
Could you please give me the id of this bug? I did not succeed to find it in Bugzilla. Is it planned to be fixed in 3.5.2?
Regards
Grant Gayed a écrit :
> Hi Mickael,
>
> Does your app create a Browser with style SWT.MOZILLA at any point? If so
> then it's possible that you're seeing an swt bug that was recently fixed.
>
> Otherwise, are your cookie name and url definitely right? To confirm this
> try navigating to the site and invoking
> browser.execute("alert(document.cookie)").
>
> HTH,
> Grant
>
>
> "Mickael Istria" <mickael.istria@bonitasoft.com> wrote in message
> news:hllqn9$8de$1@build.eclipse.org...
>> Cross-post to SWT forum to increase probability of answer.
>>
>> Mickael Istria a écrit :
>>> Hello,
>>>
>>> I need to retrieve a cookie from a Web navigation in the intro part.
>>> Indeed, the intro part contains a link to an external URL, user can
>>> browse the site with it, and the site sets a cookue. I need this cookie
>>> in an IIntroAction that can be started when clicking a link.
>>>
>>> I found the Browser.getCookie("cookieId", "http://www.bonitasoft.org")
>>> would do the trick, however this always return me null...
>>>
>>> Does anyone have an advice, a snippet or an idea for me, please?
>>>
>>> Regards,
>>> --
>>> Mickael Istria - BonitaSoft S.A.
>>> http://www.bonitasoft.com/products/downloads.php
>
>
--
--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
|
|
|
Re: Retrieve cookies from introPart [message #516074 is a reply to message #515670] |
Mon, 22 February 2010 16:43 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
The bug I referred to would only happen when Browsers with styles SWT.NONE
and SWT.MOZILLA are both being used, an SWT.NONE-style Browser that uses
mozilla as its renderer would not see this problem. There wasn't a report
for the bug, I just stumbled across it and fixed it when I was writing my
previous response. If you want to see if this fix helps your case then you
can try getting tomorrow's integration build, but I don't think it will make
a difference. And it's not planned for 3.5.2, it's too late in the 3.5.2
cycle to add a change like this.
So assuming that this is a different problem, can you replace your
"getCookie()" call with "alert(document.cookie)" to confirm that the cookie
you're expecting to find is definitely set with the expected name? And is
the page that sets the cookie definitely completed loading before you make
the call?
Grant
"Mickael Istria" <mickael.istria@bonitasoft.com> wrote in message
news:hlmh8k$2ti$1@build.eclipse.org...
> Hello Grant,
>
> Yes, our app starts a brower from time to time. We don't force it to use
style SWT.MOZILLA, but since I run on Linux, it is probably implicit. For
example, I imagine that, on Linux, the introPart opens a browser with such
style, doesn't it?
>
> Could you please give me the id of this bug? I did not succeed to find it
in Bugzilla. Is it planned to be fixed in 3.5.2?
>
> Regards
>
>
> Grant Gayed a
|
|
|
Re: Retrieve cookies from introPart [message #516102 is a reply to message #516074] |
Mon, 22 February 2010 18:39 |
|
Grant Gayed a écrit :
> The bug I referred to would only happen when Browsers with styles SWT.NONE
> and SWT.MOZILLA are both being used, an SWT.NONE-style Browser that uses
> mozilla as its renderer would not see this problem. There wasn't a report
> for the bug, I just stumbled across it and fixed it when I was writing my
> previous response. If you want to see if this fix helps your case then you
> can try getting tomorrow's integration build, but I don't think it will make
> a difference. And it's not planned for 3.5.2, it's too late in the 3.5.2
> cycle to add a change like this.
Ok, then this is probably nor related at all.
> So assuming that this is a different problem, can you replace your
> "getCookie()" call with "alert(document.cookie)" to confirm that the cookie
> you're expecting to find is definitely set with the expected name? And is
> the page that sets the cookie definitely completed loading before you make
> the call?
Thanks for the trick of invoking javascript programmatically, it is a very useful!
It seems that the cookies I am looking for are not available whenever I try to retrieve them (they don't appear in the alert box). The strange thing is that these cookies are added after a login operation on a page, and once logged in they don't seem to be lost, since I stay logged in all along my navigation. But I cannot retrieve them at any point.
When I watch my session with Firefox and Firebug, I clearly see those cookies added to my session when logging in. They are mandatory for most operations, and I can perform these operations in Eclipse browser...
Do you have any idea of why I cannot retrieve these cookies, that clearly seem to be here (otherwise, I would not see the same things in the browser) ?
Thanks in advance
--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
|
|
| |
Re: Retrieve cookies from introPart [message #516580 is a reply to message #516324] |
Wed, 24 February 2010 12:56 |
|
Grant Gayed a écrit :
> I'm not too familiar with techniques that could be used here to provide the
> cookies but to also make them unaccessible like this. Is it possible that
> the cookies are there but are associated with a different URL? Also, do you
> see this same behaviour with other types of embedded browsers (ie.- running
> your app on other platforms)? Hopefully someone else out there can provide
> some further suggestions.
I get the same behaviour on Windows. I'll try to investigate more at the server-side and to learn more about cookies. I'll come back to this topic as soon as I get interesting results or conclusion.
--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
|
|
|
Re: Retrieve cookies from introPart [message #517148 is a reply to message #516580] |
Fri, 26 February 2010 11:55 |
|
Ok, I took a deeper look to the issue, here are some facts:
* The cookies I am trying to get are available in the HTTP request and response (we can see them when using Firebug)
* When using "Show cookies" for this page on Firefox 3.6, we can see these cookies
* But they are not available in the dom (I cannot see them in document.cookie, neither from Firebug nor with a alert(document.cookie))
* Browser.getCookie cannot find this cookies.
* This is the same behavior on Linux and Windows.
Now my opinion:
This can be a bug in the way Browser.getCookie is implemented. Maybe it only returns cookies that can be found in document.cookie dom element, whereas it should also return cookies that can only be found in the HTTP request/response.
Should I report it in the tracker?
--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
|
|
| | |
Goto Forum:
Current Time: Thu Dec 26 11:28:43 GMT 2024
Powered by FUDForum. Page generated in 0.05753 seconds
|