Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  muffin stuff (webstart cookies)  (Read 2418 times)
0 Members and 1 Guest are viewing this topic.
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Posted 2004-08-07 10:41:52 »

Webstart demonstration:
http://kaioa.com/src/tools/MuffinStreamTest.jnlp

You'll see a JFrame with a JTextArea and nothing else. Write something... close it and start it again. The text should be there again (loaded from a muffin).

The source:
http://kaioa.com/src/tools/MuffinStreamTest.java
http://kaioa.com/src/tools/MuffinOutputStream.java
http://kaioa.com/src/tools/MuffinInputStreamGetter.java

Showsrc-ified:
http://showsrc.com/$http://kaioa.com/src/tools/MuffinStreamTest.java
http://showsrc.com/$http://kaioa.com/src/tools/MuffinOutputStream.java
http://showsrc.com/$http://kaioa.com/src/tools/MuffinInputStreamGetter.java

On the first run the load method in MuffinStreamTest will end up in the catch block, because there isn't a muffin.

Muffins should be nicer to handle with these two classes. It should be good enough for most of the webstart apps. It's written somewhat simple minded, but why not?

Design-wise it's asymetric - I'm very sorry Tongue (it just made more sense to handle it this way). One thing worth noting... the muffin itself is actually written in the close() method, because you need to know the maximum size of muffin before writing.

You'll need either the webstart devkit (I used the jnlp.jar from "javaws-1_2-dev.zip") or javaws.jar (from your javaws directory) in your classpath for compilation.

Condition of use/license:
a) don't sue me
b) use it like you want to
c) change it like you want to
d) if you find bugs or ways to improve it, let me (us) know Smiley

弾幕 ☆ @mahonnaiseblog
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #1 - Posted 2004-08-07 10:58:00 »

There is one issue with the demo...

-start
-write
-close
-start
-text is there... don't move the cursor
-close
-start
and the text is gone. That doen's happen if you move the cursor at least once. So it has something to do with that getText() thingy of JTextArea (JTextComponent actually).

Hmm. :-/

Guess cheap "" init plus append(thatText) hackery would help Tongue

edit:

No, I was wrong... it's something different, which I hadn't fully tracked down. After it was saved two times it won't get deleted (why?) and thus creation fails (insert failed in cache: target already exixts) and I forget to check if webstart actually granted us that much space...

uh uh... gonna post again if I got around fixing it.

Sorry Tongue

弾幕 ☆ @mahonnaiseblog
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #2 - Posted 2004-08-07 12:15:43 »

/me pukes

Quote

http://www.kaioa.com/src/tools/muffintest deleted
java.io.IOException: insert failed in cache: target already exixts


Haha. Very funny. Angry

Dunno what's wrong... it works nicely (=always) if I run it from my lan server Huh

And that other thing works always? I'm really somewhat puzzled right now :-/

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #3 - Posted 2004-08-07 12:36:15 »

ps.setTag(muffinURL,PersistenceService.CACHED);

That did the trick.

Quote
The individual entries can be tagged as either cached, meaning the server has an up-to-date copy, dirty, meaning the server does not have an up-to-date copy, or temporary, meaning that the file can always be recreated.


Well, I had to guess here Roll Eyes

But it makes some sense... some (the server doesn't have any copy at all, therefore it's as good as if it would be actually cached Tongue).

弾幕 ☆ @mahonnaiseblog
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #4 - Posted 2004-08-07 19:38:53 »

I tried mimicing your MuffinStreamTest.jnlp for my own jnlp file, and so I changed the variables to fit my stuff, and opened it, and got this error:

This XML file does not appear to have any style information associated with it. The document tree is shown below

Can someone clarify what I might have done wrong?

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #5 - Posted 2004-08-07 20:56:52 »

The jnlp (your's) is most likely perfectly fine.

However, the server doesn't know the mime type of jnlp files. If it's free webspace... well bad luck.

If you've paid for it you'll usually have several options... some of em are outlined here:
http://grexengine.com/sections/externalgames/articles/Kevin%20Glass-A%20Walkthrough%20with%20WebStart-JNLP-1.html

If you can use ".htaccess" you just need to add a file with that name in the root directory (or if it already exists just append the folowing line):
AddType application/x-java-jnlp-file .jnlp

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (15 views)
2014-07-30 21:08:39

Riven (22 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!