Pre-Loading Application

This document provides information about pre-loading the following types of files to improve overall application performance:

  • Images
  • Styles
  • Nexaweb and custom plug-ins

Caching Image Files Locally

By default, Nexaweb application development stores image files used in a Nexaweb application on the server-side.

However, you can specify that your Nexaweb application caches image files locally.

By caching image files locally, you:

  • Reduce the amount of network traffic required to run the application.
  • Share an image throughout an application with a single network access.

When you cache application image files locally, the client-side JVM uploads the images in a JAR file, which may slow the application launch, but speeds up the performance of the application later by reducing the amount of network traffic.

To cache application image files locally, follow these steps:

1. Package the application images in a JAR file.

2. Store the image JAR file in a project directory, for example project-root/WEB-INF/client/lib.

3. Edit the application's client configuration file, nexaweb-client.xml file as follows:
    - Locate the nexaweb-client.xml file in project-root\WEB-INF.
    - Double click on the file to open it.
      The file opens in the Nexaweb Client Configuration Editor.
    - Click Source.
    - Locate the <pre-loaded-in-applet-def> section.
    - Add an entry to the <pre-loaded-in-applet-def> section specifying where you located the
      image.jar file in your application project similar to the following:

    <archive name="images.jar"
      path="/WEB-INF/client/lib/iimages.jar"
      pack200Path="/WEB-INF/client/lib/MyLib.jar.pack.gz" />
     

      Note: Use the last line only when you use pack200 to compress the JAR file.

      - Click Nexaweb to save the nexaweb-client.xml file.

4. In your XAL client UI files, specify the image attribute identifying images used in
    the application as follows:
 
    image="classpath://image.gif"

Styles

If you package images used in styles, you must edit the default stylesheet to reflect
the location of the images as the classpath.

For example, open the default stylesheet,
project\WebContent\Nexaweb\stylesheets\xal-stylesheet.xml,
by double clicking on it.

Locate styles similar to the following:

<style applyTo=".scrollButtonDown">
<normal backgroundColor="gradient(button_normal_gradient_xal)" 
borderColor="#888888" borderStyle="solid" borderWidth="1" 
image="Nexaweb/stylesheets/nexaweb2004/images/arrow_down.gif"/>

and change them similar to the following:

<style applyTo=".scrollButtonDown">
<normal backgroundColor="gradient(button_normal_gradient_xal)" 
borderColor="#888888" borderStyle="solid"
borderWidth="1" image="classpath://arrow_down.gif"/>

Pre-Loading Nexaweb and Custom Plug-in JARS

Developers commonly use the plug-in architecture to encapsulate application functionality into reusable modules. You can provide many features for the Java client through plug-ins. However, as the plug-in architecture has some load-time overhead associated with it, follow these guidelines to improve the load time of applications that make use of client-side plugins. Note specific guidelines below for applications where MS-JVM support is required.

To set plug-in JARs to pre-load

The client classloader lazily loads plug-ins deployed to WEB-INF/client/plugins, which often results in many requests during initialization. If the initial page of your application uses any plug-ins, we recommend that you deploy them pre-loaded.

To deploy plugins pre-loaded: place the plug-in jar in WEB-INF/client/plugins/pre-loaded.

If you use Nexaweb Studio to develop your application:

  • You must create the pre-loaded folder yourself
  • Stop the server and disable auto-build for the project while you move plugins, to avoid crashing Nexaweb Studio
  • Since Upgrade Nexaweb Support in Nexaweb Studio is not aware of pre-loaded plugins, if you upgrade Nexawb Support, you will need to move the upgraded plug-ins from WEB-INF/client/plugins to WEB-INF/client/plugins/pre-loaded every time you upgrade; otherwise you will end up with a new version of the plug-ins lazily loaded, and an old version pre-loaded.

To set plug-in JARs to pre-load (MS-JVM support required)

If you use plug-ins for an application run in Microsoft JVM environments, follow these steps to set plug-in JARs to pre-load:

1. Unpack the plug-in JAR into a directory. 

2. Unpack any inner JARs (JARs contained within the plug-in JAR).

3. Package the files from the inner JARs into .cab files.

4. Create a new plugin.jar parent JAR file including all files.

5. Create a directory in the application project's /plugins directory named, pre-loaded,
    and copy the new plug-in JAR file into it.