Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving state in an applet

 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to be able to save the current game (of chess) in my applet but I'm not sure on the easiest way. I could communicate to a database but this seems like overkill. I could call a local web page that perhaps stores the game but again this looks quite difficult.

Is there an easy way of writing a string (about 300 char length) to the browser and letting it return it when that user next goes to the page. Any ideas?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the various *Stream* methods in AppletContext. I've heard people report mixed successes with this, though.
 
Andrew Thompson
Ranch Hand
Posts: 77
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mich Robinson wrote:I'd like to be able to save the current game (of chess) in my applet but I'm not sure on the easiest way. ..

Is there an easy way of writing a string (about 300 char length) to the browser and letting it return it when that user next goes to the page. Any ideas?


  • If the user's browser is running a Plug-In2 Architecture JRE, use the PersistenceService of the JNLP API.
  • Earlier JREs might store a cookie with the help of JS.
  • HTML 5 offers Local Storage.
  • A trusted applet can store the settings on the local file system.
  •  
    Mich Robinson
    Ranch Hand
    Posts: 260
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Are these techniques common?
    ie would most browsers support them?
    What happens if they're not supported?

    PS I don't have any control over user's browsers.
     
    Andrew Thompson
    Ranch Hand
    Posts: 77
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Mich Robinson wrote:Are these techniques common?
    ie would most browsers support them?
    What happens if they're not supported? ..


    The answer to each question is 'it depends on the technique you are referring to'. I am not about to write a treaties covering all possibilities. Be more specific and put some research in, before I'll offer any more.

    Mich Robinson wrote:..PS I don't have any control over user's browsers.


    And that is a good thing. If web/server side developers start thinking they have any right or power to control the user or their browser, things go down hill rapidly.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic