Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

read and write a cookie from an applet

Thread view: 
Marco - 06 Jan 2006 21:17 GMT
It is possible read or write a cookie from an applet?

I need only set the value of a variable setted from user from remember it in
next use, as setCookie(String name, string value).

The cookie must be set client size, by the site of the applet or by local,
without request to a server (only applet knows name and value, and server,
perhaps, don't exists or don't support serverside pages).

I can use javascript, if it is possible, javascript function with
document.cookie, but I don't know a way (I tryed netscape.javascript, but it
don' work on my PC, and I need a general (portable) solution.

Thank you

Marco

N.B. For the first, can I pass to applet the value that a javascript reads
by haml tags?
Chris Smith - 07 Jan 2006 02:02 GMT
> I can use javascript, if it is possible, javascript function with
> document.cookie, but I don't know a way (I tryed netscape.javascript, but it
> don' work on my PC, and I need a general (portable) solution.

That's the first thing that comes to mind.  You can't get LiveConnect
working on your computer?

The other long-shot if you've got control over the server (and I'm not
sure if this would work or not) would be to AppletContext.showDocument a
URL that convinces the server to send the cookie you want within the
same domain.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Marco - 07 Jan 2006 19:18 GMT
> The other long-shot if you've got control over the server (and I'm not
> sure if this would work or not) would be to AppletContext.showDocument a
> URL that convinces the server to send the cookie you want within the
> same domain.

I always use this; it work.

Thank you
Real Gagnon - 07 Jan 2006 02:14 GMT
> It is possible read or write a cookie from an applet?
>
> I need only set the value of a variable setted from user from remember
> it in next use, as setCookie(String name, string value).

See http://www.rgagnon.com/javadetails/java-0180.html for an example using
LiveConnect.

You can test it at http://www.rgagnon.com/examples/testcookie.html

Bye.
Signature

Real Gagnon  from  Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html

Roedy Green - 07 Jan 2006 04:18 GMT
On Sat, 07 Jan 2006 02:14:52 GMT, Real Gagnon
<realgagnon+usenet_@_yahooSpamIsBadSstripunderscore.com> wrote, quoted
or indirectly quoted someone who said :

>See http://www.rgagnon.com/javadetails/java-0180.html for an example using
>LiveConnect.

that page does not mention the word LiveConnect even once.  To me
LiveConnect is the Symantec utility to fetch program updates. To you
it is?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Andrew Thompson - 07 Jan 2006 06:02 GMT
> On Sat, 07 Jan 2006 02:14:52 GMT, Real Gagnon
> <realgagnon+usenet_@_yahooSpamIsBadSstripunderscore.com> wrote, quoted
[quoted text clipped - 6 lines]
> LiveConnect is the Symantec utility to fetch program updates. To you
> it is?

LiveConnect allows applet to interact with JavaScript,
to call JS methods.

It is a little hard to get up and running with,
<from vague memory>
..but I found I could connect a cut-down version of the liveconnect
classes jar (at around 6Kb) that allowed an applet to invoke
JS methods available to the web page.
AFAIR I needed to reference the classes for compilation, but
found they were already available to the browser VM.
</from vague memory>

It is most handy.

I am not sure of the exact origin of the name 'LiveConnect',
but it does refer/connect to the netscape.javascript package
classes mentioned in the page.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Real Gagnon - 07 Jan 2006 16:50 GMT
><from vague memory>
> ..but I found I could connect a cut-down version of the liveconnect
[quoted text clipped - 3 lines]
> found they were already available to the browser VM.
></from vague memory>

The netscape.javascript.* package is now included in %JRE_HOME%\lib
\jaws.jar file. So to compile, you need to include it in your classpath.

Bye.
Signature

Real Gagnon  from  Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html

Real Gagnon - 07 Jan 2006 16:46 GMT
>>See http://www.rgagnon.com/javadetails/java-0180.html for an example
>>using LiveConnect.
>
> that page does not mention the word LiveConnect even once.  To me
> LiveConnect is the Symantec utility to fetch program updates. To you
> it is?

LiveConnect is a programming interface. It provides JavaScript with the
ability to call methods of Java classes using the existing Java
infrastructure. The communication can also be bidirectional.

http://en.wikipedia.org/wiki/LiveConnect

Bye.
Signature

Real Gagnon  from  Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.