Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: on demand loading



On 14/11/2007, at 4:49 AM, Greg Guerin wrote:
The references I looked at for the applet tag and its archive attribute are
either ambiguous about eager vs. lazy jar loading, or they explicitly say
it's eager loading. For example, this says "preloaded", which I take to be
eager:

Applets default to lazy loading in my experience, though perhaps my experience is with the cache_archive attribute. You can usually tell because if the lazy loaded jar is large you get a long pause where everything stops while it downloads the first time you access any classes from that jar (or any class that can't be found). Note though, that jars in the archive attribute are downloaded and checked in order so if you have multiple media files you want to lazy load you'd have to sort them in order of access.


The main thing to remember about applets is that nothing can be taken for granted - test on every browser and every platform you need to support and be prepared to add specific tweaks to get it working right.

You can be explicit about eager vs lazy loading with the cache_archive_ex attribute which is best described as complex and frustrating. See:
http://java.sun.com/products/plugin/1.3/docs/appletcaching.html
http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/applet_caching.html


I'd suggest two things:

1. Ignore the classpath and just send a direct HTTP connection back to the server to get the media files yourself. Then you're in control of your own destiny. Even unsigned applets can connect back to the server that they were deployed from.

2. Don't put your media files in a jar, just put them directly on the server and use getClass().getResource() to access them. The difference here is that you're not adding the media files to the archive attribute at all. When Java can't find the class or resource you requested in any of the jars on the classpath (via archive, cache_archive, cache_archive_ex) it sends a direct request to the server for the specific file. So if you have the structure:

/index.html
/applet.jar
/com/ephox/stuff/theMedia.mov

and the class that needs to access theMedia.mov is in the package com.ephox.stuff, it can just call getClass().getResourceAsStream("theMedia.mov") and the Java plugin will return an input stream to theMedia.mov. Note though that it is in the right folder structure for the package. This works for classes as well as any other resource and will let you access the media in any order. I suspect the media won't be cached though.

The question of multiple jars separated by commas is a different issue
entirely.  The examples I found in several references show commas and
spaces, but only SAY commas.  So I think maybe try commas and spaces.

Definitely commas.

Regards,

Adrian Sutton.
______________________
Adrian Sutton, CTO
Global Direct: +1 (650) 292 9659 x717 Australia: +61 (7) 3858 0118
Ephox <http://www.ephox.com/>
Ephox Blogs <http://planet.ephox.com/>, Personal Blog <http://www.symphonious.net/ >
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden
References: 
 >Re: on demand loading (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.