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: One applet doing multiple duty on one web page?



"Dean Snyder" <email@hidden> wrote:

>I have an applet that is essentially a viewer for a certain custom file
>type. It appears that a new instance of the same applet is loaded for
>each of several of these custom files sprinkled around a single web page.
>Is it possible to have just one applet load and use this single applet to
>view several of these images on a single web page? I suspect that would
>save both a lot of download time and a lot of memory.

It would have to be a single Applet managing all the views inside its own
boundaries.  Each applet is an independent component on a web page.  Every
applet has its own context and classloader, for security reasons.  Sharing
would violate that security, or at least complicate it.

However, you might try using the extensions facility of JAR-files, or
perhaps the Class-Path attribute:
  <http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Main Attributes>

I'm not sure what any given browser's classloader will do with
JAR-extensions and Class-Paths.  It may share them across applets, or it
may not.  Personally, I think dynamic sharing is unlikely for applets.
Figuring out the security consequences for sharing applet extensions and
class-paths is probably more trouble than it's worth, since the
possibilities for it paying off would be small (i.e. only a small number of
sites would benefit), while the consequences of getting it wrong would be
dire.

One other possibility I can see is simple the browser's own web-cache, or
the JVM's JAR-cache.  Both of those would be behind any classloader, and
would act to reduce the network traffic with relatively little effect on
the applet security model.  Your applet, however, has no direct control
over browser or JVM caching.

  -- GG


 _______________________________________________
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



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.