* - each instantiated Applet is initialized using Applet.init() (this is not done for deserialized ones)
* - finally AppletS get activated using the AppletInitializerS activate-Method
*
* The order of operations is important for compatibility.
*/
Applet applet = null;
if (bean instanceof Applet)
{
// Makes a second instanceof call unneccessary (instanceof is expensive).
applet = (Applet) bean;
/* The AppletStub's code and document base is set as follows:
* The code base is always the URL from where the class data originated
* (without the package name).
* If the Applet was deserialized the document base is the location of
* the serialized instance (usually the ".ser" file) otherwise its the URL
* from where the class data originated (usually the absolute directory
* location of the ".class" file).
*/
applet.setStub(
new DummyAppletStub(
applet
.getClass()
.getProtectionDomain()
.getCodeSource()
.getLocation(),
(beanLocation == null) ? classLocation : beanLocation));
// Runs the Applet's initialization using an AppletInitializer.
if (initializer != null)
{
initializer.initialize(applet, beanContext);
}
}
// Adds the new bean to its BeanContext.
if (beanContext != null)
{
beanContext.add(bean);
}
if (applet != null)
{
// Initializes an instantiated (not deserialized) Applet using its own method.
if (beanLocation == null)
{
applet.init();
}
// Runs the Applet's activation using an AppletInitializer.
if (initializer != null)
{