Question: What are restrictions for an applet? What are applets prevented from
doing?
Answer: In general, applets loaded over the net are prevented from reading and
writing files on the client file system, and from making network connections
except to the originating host.
In addition, applets loaded over the net are prevented from starting other
programs on the client. Applets loaded over the net are also not allowed to
load libraries, or to define native method calls. If an applet could define
native method calls, which would give the applet direct access to the
underlying computer.
è Question: How can my applet require some optional packages (specific vendor and
versions)?
Answer: Since version 1.3 Java introduced support for an expanded set of Jar-file
manifest attributes.
The following portion of a sample manifest file illustrates the attributes that are
available for use by optional packages.
Extension-Name: javax.help
Specification-Vendor: Sun Microsystems, Inc
Specification-Version: 1.0
Implementation-Vendor-Id: com.sun
Implementation-Vendor: Sun Microsystems, Inc
Implementation-Version: 1.0
Note that all of the above manifest attributes should be included in an optional
package's manifest. If the plug-in looks for but doesn't find one of these attributes in
an optional package's manifest, it will assume that the optional package is not
suitable for the applet.
Note: Optional packages are the new name for what used to be known as standard
extensions. The "extension mechanism" is that functionality of the Java 2 SDK and
Java 2 Runtime Environment that supports the use of optional packages.
Optional packages are packages of Java classes (and any associated native code)
that application developers can use to extend the functionality of the core platform.
The extension mechanism allows the Java virtual machine (VM) to use the classes of
Even More Tips at http://JavaA.com and http://JavaFAQ.nu every day!!!
Copyright © 2005 http://JavaA.com http://JavaFAQ.nu alex@javafaq.nu
the optional extension in much the same way as the VM uses classes in the Java 2
Platform. The extension mechanism also provides a way for needed optional
packages to be retrieved from specified URLs when they are not already installed in
the Java 2 SDK or Runtime Environment.
From SUN's description of the Java Extension Mechanism
è Good to know: Invoking modal popup dialogs from an applet's stop or destroy
methods is not recommended if you use Java 1.4.1 and below. Using modal popup
dialogs inside these methods could result in problematic behavior, including
NullPointerException, the dialog box not being displayed, the dialog box remaining
alive even after the applet was destroyed, or in the worst case, browser hang. This
problem has been fixed in 1.4.2.
è Question: Do I need special server software to use applets?
Answer: No. Java applets may be served by any HTTP server. On the server side
they are handled the same as any other file, such as a text, image, or sound file. All
the special action happens when the applet class files are interpreted on the client
side by a Java technology-enabled browser, such as HotJava browser or 1.x or
Netscape 3.x/4.x.
source: http://java.sun.com/products/jdk/faq.html#A8
è Question: I know that applets have limited possibility to do many things. It is about
network connections, file reading/writhing and more.
Can applet read all system properties and if not how many of them are restricted?
Answer: Applets can read quite many of system properties by using:
String ss = System.getProperty(String key):
java.version
java.vendor
java.vendor.url
java.class.version
os.name
os.arch
os.version
file.separator
path.separator
line.separator
Applets are prevented from reading these system properties:
java.home
java.class.path
user.name
user.home
user.dir
source: http://java.sun.com/sfaq/
No comments:
Post a Comment