Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Saving state in an applet

 
Ranch Hand
Posts: 275
2
  • 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?
 
Rancher
Posts: 43016
76
  • 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.
 
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: 275
    2
    • 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.
     
    when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
    Devious Experiments for a Truly Passive Greenhouse!
    https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
      Bookmark Topic Watch Topic
    • New Topic