Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Retrieve cookies from introPart
Retrieve cookies from introPart [message #515371] Thu, 18 February 2010 15:18 Go to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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 #515551 is a reply to message #515371] Fri, 19 February 2010 10:55 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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 #515621 is a reply to message #515551] Fri, 19 February 2010 14:44 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
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
Re: Retrieve cookies from introPart [message #515668 is a reply to message #515621] Fri, 19 February 2010 12:24 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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 #516072 is a reply to message #515668] Mon, 22 February 2010 16:43 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
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 #516103 is a reply to message #516072] Mon, 22 February 2010 18:39 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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 #516319 is a reply to message #516103] Tue, 23 February 2010 10:32 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
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.

Grant


"Mickael Istria" <mickael.istria@bonitasoft.com> wrote in message
news:hluj10$r45$1@build.eclipse.org...
> Grant Gayed a
Re: Retrieve cookies from introPart [message #516577 is a reply to message #516319] Wed, 24 February 2010 08:04 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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 #517149 is a reply to message #516577] Fri, 26 February 2010 11:55 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
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
Re: Retrieve cookies from introPart [message #517225 is a reply to message #517149] Fri, 26 February 2010 11:08 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Sure, please log a bug for this at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT ,
and provide a way to replicate the problem (eg.- is there a public site that
shows this happening?).

Grant


"Mickael Istria" <mickael.istria@bonitasoft.com> wrote in message
news:hm8cse$o9s$1@build.eclipse.org...
> 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
Re: Retrieve cookies from introPart [message #517250 is a reply to message #517225] Fri, 26 February 2010 16:29 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 765
Registered: July 2009
Location: Grenoble, France
Senior Member
Ok, I reported it in Bug 304059 (http://bugs.eclipse.org/304059).\
Thanks Grant.

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Previous Topic:JUnit only runs properly in debug mode
Next Topic:Why my IStorageMerger is not called?
Goto Forum:
  


Current Time: Sun Oct 26 01:23:11 GMT 2014

Powered by FUDForum. Page generated in 0.02249 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software