You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by michig54 <mi...@hotmail.com> on 2012/08/02 19:39:33 UTC
Using Cookies with JSObject and exposing java.applet.Applet
Hello,
I wish to experiment with using cookies and the easiest way that I found was
to use JSObject. But AFAIK the only way to get a JSObject instance is by
calling JSObject.getWindow (java.applet.Applet). Apache pivot does not seem
to expose the underlying java.applet.Applet instance, nor does it expose
BrowserApplicationContext.HostApplet which extends java.applet.Applet.
How can I get at the underlying java.applet.Applet instance so that I can
create a JSObject? Or is there another way of creating a JSObject? If
neither of those methods are possible, is there another suggestion for
reading/writing cookies without signing?
Thanks!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Using-Cookies-with-JSObject-and-exposing-java-applet-Applet-tp4021991.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Re: Using Cookies with JSObject and exposing java.applet.Applet
Posted by Sandro Martini <sa...@gmail.com>.
Hi, good news from you ... very good :-)
Sorry, I forgot the attachment (just for reference), you can find it
here now ...
Note: if someone need some (useful in general, and generic) utility
functions like Cookie handling from the Applet, and better interaction
with the page (as needed in your case), tell us with a real use case,
so we can see at what could be added for our release 2.1 ...
Bye
Re: Using Cookies with JSObject and exposing java.applet.Applet
Posted by michig54 <mi...@hotmail.com>.
Awesome thank you!
I actually only needed the document to write/read cookies.
In my html javascript code after calling deployjava, i was able set the
document using the following:
Here is my setDocument function...
And my set and get cookie functions...
I got these functions from
http://www.rgagnon.com/javadetails/java-0180.html
http://www.rgagnon.com/javadetails/java-0180.html
Thanks again.
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Using-Cookies-with-JSObject-and-exposing-java-applet-Applet-tp4021991p4021997.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Re: Using Cookies with JSObject and exposing java.applet.Applet
Posted by Sandro Martini <sa...@gmail.com>.
Hi, welcome to Pivot.
Yesterday I finish to commit a small test/sample minimal Applet (that
can run even as standard Application, for some things) both in our
maintenance branch (for our next 2.0.3), and in trunk (for 2.1
release), but sorry you have to look at them with a Subversion client.
For example look here:
http://svn.apache.org/repos/asf/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/
> How can I get at the underlying java.applet.Applet instance so that I can create a JSObject?
> Or is there another way of creating a JSObject?
In Pivot859.java there are some methods called from Javascript (from
the html page), to set/get some values into/from the Applet.
To get a reference to the Applet, you can call the method
getApplication(...) of BrowserApplicationContext, like in
pivot859.html .
In attach I put a working copy of its related test html page,
containing all relative path and version good for a local test
environment.
If you need more help, ask to us ...
We have some other sample on interaction between browser and applets,
look at DOMInteractionDemo.java, and its usage of method eval(...) of
BrowserApplicationContext. If possible today I'll put some other info
in DOMInteractionDemo, and commit them.
> If neither of those methods are possible, is there another suggestion for reading/writing cookies without signing?
I'm sorry, but don't know if in that way you can share a cookie
between the browser and the applet , so maybe you could even try to
read it from JavaScript, and sent its data to the Applet ... otherwise
you could try to create a new Cookie inside the applet, using Java
Cookie classes ... for example look here:
https://blogs.oracle.com/CoreJavaTechTips/entry/cookie_handling_in_java_se
Anyway, keep us updated :-) .
Bye,
Sandro